//#define _GLIBCXX_DEBUG #include #include #include #include using namespace std; using namespace atcoder; using mint = modint1000000007; using ll = long long; using pii = pair; using pll = pair; using vi = vector; using vvi = vector; using vl = vector; using vvl = vector; using vb = vector; using vvb = vector; using vm = vector; using vvm = vector; using vpi = vector; using vvpi = vector; using vpl = vector; using vvpl = vector; const int inf = 1 << 30; const ll INF = 1LL << 60; #define rep(i,m,n) for (int i = m; i < (int)(n); i++) #define rrep(i,m,n) for (int i = m; i > (int)(n); i--) int main(){ ll a,b; cin >> a >> b; mint ans = 1; if ((a-b)%2 == 0){ mint ju1 = 1, ju2 = 1; ju1 *= a+1; ju1 *= b+1; ju2 *= a; ju2 *= b; ans = ju1+ju2; cout << ans.val() << endl; } else{ mint ju1 = 1, ju2 = 1; ju1 *= a; ju1 *= b+1; ju2 *= a+1; ju2 *= b; ans = ju1+ju2; cout << ans.val() << endl; } }