import java.util.*; public class Main { static final int MOD = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt() + 1; int[] as = new int[n]; long sum = 0; for (int i = 0; i < n; i++) { as[i] = sc.nextInt(); sum += as[i]; } sum %= MOD; long ans = 0; for (int i = 0; i < n; i++) { int x = sc.nextInt(); ans += sum * x % MOD; ans %= MOD; sum += MOD - as[n - i - 1]; sum %= MOD; } System.out.println(ans); } }