Skip to content

Instantly share code, notes, and snippets.

@Chgtaxihe
Created January 7, 2020 11:00
Show Gist options
  • Save Chgtaxihe/b7b680cf1157cb4035ffb6330cafbc6f to your computer and use it in GitHub Desktop.
Save Chgtaxihe/b7b680cf1157cb4035ffb6330cafbc6f to your computer and use it in GitHub Desktop.
Codeforces 1248 #Codeforces
#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