N = int(input()) + 1 A = [int(input()) for i in range(N)] B = [int(input()) for i in range(N)] ans = 0 MOD = 10**9 + 7 for i in range(N) : for j in range(N) : if i+j > N-1 : continue ans += A[i]*B[j] ans %= MOD print(ans)