import numpy as np MOD = 10 ** 9 + 7 if __name__ == "__main__": H, W = map(int, input().split(" ")) field = np.zeros((H, W)) ret = 0 for h in range(1, H): for w in range(1, W): if field[h][w] == 0: ret += (H - h) * (W - w) * 2 ret %= MOD i = 1 while h * i < H and w * i < W: field[h * i][w * i] = 1 i += 1 ret += (H - 1) * W + H * (W - 1) ret %= MOD print(ret)