#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 5;
int fact[N], invfact[N];
long long pow(long long a, long long b, long long m) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans;
}
long long modinv(long long k) { return pow(k, 1000000007 - 2, 1000000007); }
long long nCr(long long x, long long y) {
  if (y > x) return 0;
  long long num = fact[x];
  num *= invfact[y];
  num %= 1000000007;
  num *= invfact[x - y];
  num %= 1000000007;
  return num;
}
int main() {
  long long m, n;
  cin >> n >> m;
  long long temp = n * m;
  temp += 2;
  temp = temp % 1000000007;
  cout << temp;
  return 0;
}
