#include <bits/stdc++.h>
using namespace std;
long long binpow(long long a, long long b) {
  long long int m = 1000000007;
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
int main() {
  std::ios::sync_with_stdio(false);
  long long int T = 1, n, m;
  string str;
  while (T--) {
    long long int p = 0, q = 0, tmp = 0, sum = 0, count = 0;
    int flag = 0;
    cin >> n >> m;
    long long int a[100002];
    a[1] = 2;
    a[2] = 4;
    for (long long int i = 3; i < 100002; ++i) {
      a[i] = a[i - 1] + a[i - 2];
    }
    long long int y = binpow(2, (m + 1) / 2);
    long long int x = a[n];
    cout << x + y << "\n";
  }
  return 0;
}
