#include #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ); using namespace std; using ll = long long; const ll Mod = 1e9 + 7; int main(){ int n; cin >> n; n++; vector a(n+1), b(n+1); rep(i, n) cin >> a[i]; rep(i, n){ ll tmp; cin >> tmp; b[i+1] += tmp + b[i]; b[i+1] %= Mod; } reverse(all(b)); ll ans = 0; rep(i, n){ ans += (a[i] * b[i]) % Mod; ans %= Mod; } cout << ans << endl; }