def linelist(T=int): return [T(x) for x in input().split()] def read(T=int): return T(input()) def ndarray(dims, v=0): if len(dims) == 1: return [v for _ in range(dims[0])] else: return [ndarray(dims[1:], v) for _ in range(dims[0])] import numpy as np modp = 10**9+7 n = read() a = np.zeros(n+1) b = np.zeros(n+1) for i in range(n+1): a[i] = read() for i in range(n+1): b[i] = read() ans = 0 suma = 0 for i in range(n+1): suma += a[i] suma %= modp ans += suma * b[n-i] ans %= modp print(ans)