from itertools import accumulate from sys import stdin def main(): N = int(input()) A = [int(input()) for _ in [0] * (N + 1)] B = [int(input()) for _ in [0] * (N + 1)] mod = 1000000007 a = list(accumulate(A)) a.reverse() ans = 0 for a_, b_ in zip(a, B): ans += a_ * b_ print(ans % mod) input = lambda: stdin.readline() main()