def main() -> None: A, B = map(int, input().split()) if A % 2 == B % 2: print(((2 * A + 1) * (2 * B + 1) + 1) // 2 % (10**9 + 7)) else: print(((2 * A + 1) * (2 * B + 1) - 1) // 2 % (10**9 + 7)) if __name__ == '__main__': main()