fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn main() { let n = read::() + 1; let mut a = vec![0i128; n]; let mut b = vec![0i128; n]; let big_int = 1000_000_000 + 7; for i in 0..n { a[i] = read(); } for i in 0..n { b[i] = read(); } let mut b_sum = vec![0; n]; for i in 0..n { b_sum[0] += b[i]; b_sum[0] %= big_int; } for i in 1..n { b_sum[i] %= big_int; b_sum[i] = b_sum[i - 1] - b[n - i]; } let mut ans: i128 = 0; for i in 0..n { ans += a[i] * b_sum[i]; ans %= big_int; } ans += big_int; ans %= big_int; println!("{:?}", ans); }