import numpy as np mod =10**9+7 n = int(input()) A = list(int(input()) for _ in range(n+1)) B = list(int(input()) for _ in range(n+1)) A = np.cumsum(A) ans = 0 for i in range(n+1): ans += A[i]*B[n-i] print(ans%mod)