def task_1(n, m): # n - строки m - столбцы
    counts = 8
    start = (2, 2, 2, 2)
    counts = n*(m+1)
    print(counts%(10**9+7))

if __name__ == '__main__':
    # Number of requests
    n, m = (map(int, input().rstrip().split()))
    task_1(n, m)