#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  scanf("%lld%lld", &n, &m);
  if (n == 1 || m == 1) {
    cout << "2\n";
  } else {
    long long dif1 = n - 1;
    long long dif2 = m - 2;
    long long sum = dif1 + dif2;
    long long res = 2;
    if (sum % 2 == 1) {
      res += (6 * (sum / 2)) % 1000000007;
      res = (res + 4) % 1000000007;
    } else {
      res += (6 * (sum / 2)) % 1000000007;
    }
    cout << res << "\n";
  }
  return 0;
}
