n = int(input()) A = [int(input()) for _ in range(n + 1)] B = [int(input()) for _ in range(n + 1)] mod = 10**9 + 7 accumB = [B[0]] for i in range(1, n + 1): accumB.append((accumB[-1] + B[i]) % mod) ans = 0 for i in range(n + 1): ans += A[i] * accumB[n - i] % mod ans %= mod print(ans)