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