// yukicoder: 754 畳み込みの和 // 2019.5.13 bal4u #include typedef long long ll; #define M 1000000007 #if 1 #define gc() getchar_unlocked() #else #define gc() getchar() #endif int in() // 非負整数の入力 { int n = 0, c = gc(); do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0'); return n; } int a[100005], b[100005], sb[100005]; int main() { int i, n, ans; n = in(); for (i = 0; i <= n; i++) a[i] = in(); sb[0] = 0; for (i = 0; i <= n; i++) { b[i] = in(), sb[i+1] = ((ll)sb[i] + b[i]) % M; } ans = 0; for (i = 0; i <= n; i++) { ans = (ans + (ll)a[i]*sb[n-i+1]) % M; } printf("%d\n", ans); return 0; }