n = int(input()) A = [int(input()) for _ in range(n+1)] B = [int(input()) for _ in range(n+1)] mod = 10**9+7 from itertools import accumulate CA = list(accumulate(A)) ans = 0 for i, b in enumerate(B): ans += b*CA[n-i]%mod ans %= mod print(ans%mod)