n = int(input()) a = [int(input()) for i in range(n+1)] b = [int(input()) for i in range(n+1)] s = [0]*(n+2) for i in range(n+1): s[i+1] = s[i] + b[i] s = s[::-1] ans = 0 for i in range(n+1): ans += s[i]*a[i] print(ans%(10**9+7))