#include <bits/stdc++.h>
using namespace std;
void mat_mul(vector<vector<long long> > &a, vector<vector<long long> > &b,
             vector<vector<long long> > &c) {
  vector<vector<long long> > d(a.size(), vector<long long>(b[0].size(), 0));
  for (int i = 0; i < a.size(); i++) {
    for (int j = 0; j < a.size(); j++) {
      for (int k = 0; k < b[0].size(); k++) {
        d[i][k] += a[i][j] * b[j][k];
        d[i][k] %= 1000000007;
      }
    }
  }
  c = d;
}
void bin_exp(int n, vector<vector<long long> > &mat,
             vector<vector<long long> > &res) {
  vector<vector<long long> > resx(mat.size(), vector<long long>(mat.size(), 0));
  for (int i = 0; i < mat.size(); i++) {
    resx[i][i] = 1;
  }
  for (; n > 0; n /= 2) {
    if (n % 2 == 1) {
      mat_mul(resx, mat, resx);
    }
    mat_mul(mat, mat, mat);
  }
  res = resx;
}
int main(void) {
  cin.tie(0)->sync_with_stdio(0);
  vector<vector<long long> > mat(2, vector<long long>(2, 0));
  mat[0][0] = 0;
  mat[0][1] = 1;
  mat[1][0] = 1;
  mat[1][1] = 1;
  int n, m;
  cin >> n;
  cin >> m;
  vector<vector<long long> > dp(2, vector<long long>(1, 0));
  dp[0][0] = 0;
  dp[1][0] = 1;
  bin_exp(n, mat, mat);
  mat_mul(mat, dp, dp);
  long long fib_n = dp[1][0];
  mat[0][0] = 0;
  mat[0][1] = 1;
  mat[1][0] = 1;
  mat[1][1] = 1;
  dp[0][0] = 0;
  dp[1][0] = 1;
  bin_exp(m, mat, mat);
  mat_mul(mat, dp, dp);
  long long fib_m = dp[1][0];
  long long ans = (2 * (fib_n + fib_m)) % 1000000007;
  ans -= 2;
  cout << ans << "\n";
}
