#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF (1<<29) #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(v) v.begin(),v.end() #define uniq(v) v.erase(unique(all(v)),v.end()) #define MOD 1000000007 int n; int a[100001]; int b[100001]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; rep(i, n+1)cin >> a[i]; rep(i, n+1)cin >> b[i]; long long s = 0; long long ans = 0; rep(i, n+1)(s += b[i]) %= MOD; rep(i,n+1) { ans += s * a[i]; ans %= MOD; s = (s - b[n - i] + MOD) % MOD; } cout << ans << endl; return 0; }