#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define all(x) (x).begin(),(x).end() #define rep(i,m,n) for(int i = m;i < n;++i) #define pb push_back #define fore(i,a) for(auto &i:a) #define rrep(i,m,n) for(int i = m;i >= n;--i) #define INF INT_MAX/2 using namespace std; using ll = long long; using R = double; using Data = pair>; const ll MOD = 1e9 + 7; const ll inf = 1LL << 50; struct edge { ll from; ll to; ll cost; }; ll sum[101010]; int main() { ll n; cin >> n; rep(i, 0, n+1) { ll a; cin >> a; if (i) { sum[i] = sum[i - 1] + a; } else { sum[i] = a; } sum[i] %= MOD; } ll ans = 0; rep(i, 0, n + 1) { ll b; cin >> b; ans += b *sum[n - i]; ans %= MOD; } cout << ans << endl; return 0; }