#!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools import bisect import heapq def input(): return sys.stdin.readline()[:-1] # sys.setrecursionlimit(1000000) # _INPUT = """# paste here... # """ # sys.stdin = io.StringIO(_INPUT) INF = 10**10 MOD = 10**9+7 A, B = map(int, input().split()) A %= MOD B %= MOD if A%2 == B%2: ans = ((A+1)*(B+1)+A*B) % MOD else: ans = (A*(B+1)+(A+1)*B) % MOD print(ans)