import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt() + 1; long[] a = new long[n]; long[] b = new long[n]; for(int i = 0; i < n; i++) { a[i] = sc.nextLong(); } for(int i = 0; i < n; i++) { b[i] = sc.nextLong(); } sc.close(); long mod = (long)Math.pow(10, 9) + 7; long ans = 0; long[] B = new long[n]; B[0] = b[0]; for(int i = 1; i < n; i++) { B[i] += B[i - 1] + b[i]; B[i] %= mod; } for(int i = 0; i < n; i++) { ans += a[i] * B[n - i - 1]; ans %= mod; } System.out.println(ans); } }