#include using namespace std; using ll = long long; using P = pair; #define fix(x) fixed << setprecision(x) #define asc(x) x, vector, greater #define rep(i, n) for(ll i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a vector> MatrixProduct(vector> vec1, vector> vec2){ int N = vec1.size(), M = vec2[0].size(), L = vec2.size(); vector> res(N,vector(M,0)); rep(i,N) rep(j,M) rep(k,L) res[i][j] = (res[i][j] + vec1[i][k] * vec2[k][j]) % MOD; return res; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll n; cin >> n; vector> a(1,vector(2,0)), t(2,vector(2,0)); a[0][0] = t[0][0] = t[0][1] = t[1][0] = 1; while(n){ if(n&1) a = MatrixProduct(t,a); t = MatrixProduct(t,t); n >>= 1; } cout << (a[0][0]+a[0][1]-1+MOD) % MOD << '\n'; return 0; }