#include <bits/stdc++.h>
#pragma GCC optimize("O3")
long long int gcd(long long int a, long long int b) {
  return (b ? gcd(b, a % b) : a);
}
long long int P(long long int B, long long int power) {
  long long int ans = 1;
  while (power > 0) {
    if (power % 2 == 1) {
      ans = (ans * B) % 1000000007;
    }
    B = (B * B) % 1000000007;
    power /= 2;
  }
  return ans;
}
bool isPrime(long long int n) {
  if (n <= 1) {
    return false;
  }
  if (n <= 3) {
    return true;
  }
  if (n % 2 == 0 || n % 3 == 0) {
    return false;
  }
  for (long long int i = 5; i * i <= n; i += 6) {
    if (n % i == 0 || n % (i + 2) == 0) {
      return false;
    }
  }
  return true;
}
using namespace std;
long long int dp[100005][3][3][3][3], sdp[100005][3][3], n, m;
long long int op(long long int pos, long long int a, long long int ac,
                 long long int b, long long int bc) {
  if (pos == m + 1) {
    return 1;
  }
  if (dp[pos][a][ac][b][bc] != -1) {
    return dp[pos][a][ac][b][bc];
  }
  long long int k = 0, x, y, p, q;
  for (long long int i = 0; i < 2; i++) {
    if (a == i) {
      x = ac + 1;
    } else {
      x = 1;
      for (long long int j = 0; j < 2; j++) {
        if (j == b) {
          y = bc + 1;
        } else {
          y = 1;
        }
        p = x;
        q = y;
        if (i == j) {
          p++;
          q++;
        }
        if (p <= 2 && q <= 2) {
          k += op(pos + 1, i, p, j, q);
          k %= 1000000007;
        }
      }
    }
  }
  return dp[pos][a][ac][b][bc] = k;
}
long long int sop(long long int pos, long long int a, long long int ac) {
  if (pos == m + 1) {
    return 1;
  }
  if (sdp[pos][a][ac] != -1) {
    return sdp[pos][a][ac];
  }
  long long int k = 0, x, y;
  for (long long int i = 0; i < 2; i++) {
    if (a == i) {
      x = ac + 1;
    } else {
      x = 1;
    }
    if (x <= 2) {
      k += sop(pos + 1, i, x);
      k %= 1000000007;
    }
  }
  return sdp[pos][a][ac] = k;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  cin >> n >> m;
  long long int a, b, c, x, y, z;
  if (n > m) {
    swap(n, m);
  }
  if (n == 1) {
    for (long long int i = 0; i < m + 1; i++) {
      for (long long int j = 0; j < 3; j++) {
        for (long long int k = 0; k < 3; k++) {
          sdp[i][j][k] = -1;
        }
      }
    }
    a = sop(1, 0, 0);
    cout << a << "\n";
  } else {
    for (long long int i = 0; i < m + 1; i++) {
      for (long long int j = 0; j < 3; j++) {
        for (long long int k = 0; k < 3; k++) {
          for (long long int ac = 0; ac < 3; ac++) {
            for (long long int bc = 0; bc < 3; bc++) {
              dp[i][j][k][ac][bc] = -1;
            }
          }
        }
      }
    }
    a = op(1, 0, 0, 0, 0);
    cout << a << "\n";
  }
  return 0;
}
