Created
January 7, 2020 11:00
-
-
Save Chgtaxihe/b7b680cf1157cb4035ffb6330cafbc6f to your computer and use it in GitHub Desktop.
Codeforces 1248 #Codeforces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
#define ll long long | |
#define Android ios::sync_with_stdio(false), cin.tie(NULL) | |
using namespace std; | |
const ll inf=0x3f3f3f3f3f3f3f3f; | |
const ll mod = 1e9 + 7; | |
ll fib(int n){ | |
int a = 1, b = 1, c; | |
if(n <= 1) return 1; | |
for(int i=2; i<=n; i++){ | |
c = (a + b) % mod; | |
a = b, b = c; | |
} | |
return c; | |
} | |
void solve(){ | |
int n, m; | |
cin >> n >> m; | |
cout << (fib(n) + fib(m) - 1) % mod * 2 % mod << '\n'; | |
} | |
signed main(){ | |
Android; | |
solve(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment