#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int dp[m + 1][2];
  memset(dp, 0, sizeof(dp));
  dp[1][0] = 2;
  dp[1][1] = 0;
  for (long long int i = 2; i <= m; i++) {
    dp[i][0] = (dp[i - 1][0] + dp[i - 1][1]);
    dp[i][1] = dp[i - 1][0];
    dp[i][0] %= 1000000007;
    dp[i][1] %= 1000000007;
  }
  if (n > 1)
    cout << (dp[m][0] + dp[m][1] + n) % 1000000007 << "\n";
  else
    cout << (dp[m][0] + dp[m][1]) % 1000000007 << "\n";
}
