Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- // #include<stdio.h>
- // #include<windows.h>
- // #include<conio.h>
- // #include<time.h>
- using namespace std;// |\__/,| (`\
- // _.|o o |_ ) )
- /// ================================ Define Part ==========(((===(((=============
- #define FOR(i, a, b) for (int i = (a); i < (b); ++i)
- #define F0R(i, a) FOR (i, 0, a)
- #define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
- #define R0F(i, a) ROF (i, 0, a)
- #define trav(a, x) for (auto& a: x)
- #define bk back()
- #define ft front()
- #define pb push_back
- #define mp make_pair
- #define lb lower_bound
- #define ub upper_bound
- #define eb emplace_back
- #define rsz resize
- #define ins insert
- #define fus first
- #define sec second
- #define itr iterator
- #define elif else if
- #define elifn else ifn
- #define sz(x) int(x.size())
- #define ifn(x) if(!(x))
- #define sqr(x) ((x)*(x))
- #define all(x) (x).begin(), (x).end()
- #define inpair(x) x.fus >> x.sec
- #define oupair(x) x.fus << x.sec
- #define whilen(x) while(!(x))
- typedef long long ll; typedef double db;
- typedef map<int, int> mi; typedef map<ll, ll> mll; typedef map<db, db> mdb;
- typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef pair<db, db> pdb;
- typedef set<int> si; typedef set<ll> sll; typedef set<db> sdb;
- typedef set<pi> spi; typedef set<pll> spll; typedef set<pdb> spdb;
- typedef vector<string> vs; typedef vector<vs> v2_s; typedef vector<v2_s> v3_s;
- typedef vector<bool> vb; typedef vector<vb> v2_b; typedef vector<v2_b> v3_b;
- typedef vector<int> vi; typedef vector<vi> v2_i; typedef vector<v2_i> v3_i;
- typedef vector<ll> vll; typedef vector<vll> v2_ll; typedef vector<v2_ll> v3_ll;
- typedef vector<db> vdb; typedef vector<vdb> v2_db; typedef vector<v2_db> v3_db;
- typedef vector<pi> vpi; typedef vector<vpi> v2_pi; typedef vector<v2_pi> v3_pi;
- typedef vector<pll> vpll; typedef vector<vpll> v2_pll; typedef vector<v2_pll> v3_pll;
- typedef vector<pdb> vpdb; typedef vector<vpdb> v2_pdb; typedef vector<v2_pdb> v3_pdb;
- /// ================================ Independent Functions ================================
- template<typename T>inline T maximize (T &a, T b) { return a = max(a, b); }
- template<typename T>inline T minimize (T &a, T b) { return a = min(a, b); }
- template<typename T>inline T gcd (T a, T b) { while (b != 0) swap(b, a %= b); return a; }
- template<typename T>inline T lcm (T a, T b) { return a/gcd(a, b)*b; }
- template<typename T>inline string tostr (T x) { stringstream ss; ss << x; return ss.str(); }
- template<typename T>inline T tonum (string x) { stringstream ss(x); T n; ss >> n; return n; }
- template<typename T>inline T pct (T x) { return __builtin_popcount(x); }
- template<typename T>inline T bits (T x) { return 31 - __builtin_clz(x); }
- template<typename T>inline T cdiv (T a, T b) { return a/b + (a >= 0 && a%b); }
- template<typename T>inline bool bitGet (T x, int bit)/* ___/| */{ return T(1) & (x >> bit); }
- template<typename T>inline void bitSet (T &x, int bit)/* \o.O| */{ x |= (T(1) << bit); }
- template<typename T>inline void bitReset (T &x, int bit)/* (___) */{ x &= ~(T(1) << bit); }
- template<typename T>inline void bitFlip (T &x, int bit)/* U */{ x ^= (T(1) << bit); }
- template<typename T>inline void bitMake (T &x, int bit, bool v) { x ^= (T(1) << bit) & (-v ^ x); }
- template<typename T>inline void writeSigned (T x) {if (x < 0) putchar('-'), x = -x; writeUnsign(x); }
- template<typename T>inline void getString (T& s) {char c;while(c=getchar(),c==' '||c=='\n'||c=='\t');s.clear();s.pb(c);while(c=getchar(),c!=EOF&&c!=' '&&c!='\n'&&c!='\t')s.pb(c);}
- template<typename T>inline void getSigned (T& n) {char c;while(c=getchar(),c!='-'&&(c<'0'||c>'9'));bool sign(c=='-');if(sign)c=getchar();n=c-'0';while(c=getchar(),c>='0'&&c<='9')n=10*n+c-'0';if(sign)n=-n;}
- inline int readint() { int x; return getSigned(x), x; }
- inline ll readll() { ll x; return getSigned(x), x; }
- inline string readstring() { string s; return getString(s), s; }
- inline void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
- inline void setIn (string s) { freopen(s.c_str(), "r", stdin); }
- inline void setOut (string s) { freopen(s.c_str(), "w", stdout); }
- /// ================================ Dependent Functions ================================
- const db PI = acos(-1);
- const ll LINF = (1LL << 60); /// 1e18 ,,__
- const int INF = (1 << 30); /// 1e9 c'' )? oink oink im so cute <3
- const int LIM = (1 << 24); /// 1e7 ''''
- const int LOVE = 1411;
- const int MOD = 1e9 + 7;
- /// ================================ Main part ================================
- v2_ll operator*(v2_ll a, v2_ll b){
- int m = sz(a), n = sz(a[0]), k = sz(b[0]);
- v2_ll c(m, vll(k, 0));
- F0R(i, m)
- F0R(j, k)
- F0R(l, n)
- c[i][j] += ((a[i][l]%MOD)*(b[l][j]%MOD))%MOD;
- return c;
- }
- template<typename T> T power(T x, ll n){
- if(n == 1) return x;
- T temp = power(x, n/2);
- if(n%2)
- return temp*temp*x;
- else
- return temp*temp;
- }
- int main(){
- v2_ll a = {{0, 1}, {1, 1}},
- b = {{0, 1}};
- ll n; cin >> n;
- v2_ll c = b*power(a, n);
- cout << c[0][0];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement