n = int(input().strip()) a = [int(input().strip()) for _ in range(n + 1)] b = [int(input().strip()) for _ in range(n + 1)] tmp = sum(b) ans = 0 for j, i in enumerate(a): ans += i * tmp tmp -= b.pop() print(ans % (10**9 + 7))