N = int(input()) A = [] for i in range(N + 1): A.append(int(input())) S = sum(A) ans = 0 mod = 10 ** 9 + 7 for i in range(N + 1): ans += S * int(input()) ans %= mod S -= A.pop() print(ans)