#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.14159265358979323846264338;
const long long INF = 1000000000000000000;
const long long INF1 = 1000000000;
const long long MOD = 1000000007;
long long mpow(long long a, long long b) {
  a %= MOD;
  if (!b) return 1;
  long long temp = mpow(a, b / 2);
  temp = (temp * temp) % MOD;
  if (b % 2) return (a * temp) % MOD;
  return temp;
}
long long _pow(long long a, long long b) {
  if (!b) return 1;
  long long temp = _pow(a, b / 2);
  temp = (temp * temp);
  if (b % 2) return (a * temp);
  return temp;
}
long long mod_in(long long n) { return mpow(n, MOD - 2); }
long long cl(long long a, long long b) {
  if (a % b) return 1 + a / b;
  return a / b;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
const int maxn = 1e5 + 5;
int dp[maxn][2][2] = {};
int n, m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T;
  T = 1;
  while (T--) {
    cin >> n >> m;
    if (m < n) swap(m, n);
    dp[1][0][0] = 1;
    dp[1][1][0] = 1;
    for (int i = 2; i <= m; i++) {
      dp[i][0][0] = dp[i - 1][1][0] + dp[i - 1][1][1];
      dp[i][0][1] = dp[i - 1][0][0];
      dp[i][1][0] = dp[i - 1][0][0] + dp[i - 1][0][1];
      dp[i][1][1] = dp[i - 1][1][0];
    }
    long long ans = 0;
    cout << dp[m][0][0] << " " << dp[m][0][1] << " " << dp[m][1][0] << " "
         << dp[m][1][1] << "\n";
    ans = (ans + dp[m][0][0]) % MOD;
    ans = (ans + dp[m][0][1]) % MOD;
    ans = (ans + dp[m][1][0]) % MOD;
    ans = (ans + dp[m][1][1]) % MOD;
    ans = (ans - 2) % MOD;
    if (ans < 0) ans += MOD;
    long long num = mpow(2, n);
    long long sum = (ans + num) % MOD;
    cout << sum << "\n";
  }
}
