import std.stdio, std.conv, std.string, std.bigint; import std.math, std.random, std.datetime; import std.array, std.range, std.algorithm, std.container; string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; } const long mod = 1_000_000_007; void main(){ int n = read.to!int; long[] as, bs; foreach(i; 0 .. n + 1) as ~= read.to!long; foreach(i; 0 .. n + 1) bs ~= read.to!long; long ans = 0; long sum = 0; foreach(i; 0 .. n + 1){ sum += as[i]; sum %= mod; ans += sum * bs[n - i]; ans %= mod; } ans.writeln; }