#include #define FOR(v, a, b) for(int v = (a); v < (b); ++v) #define FORE(v, a, b) for(int v = (a); v <= (b); ++v) #define REP(v, n) FOR(v, 0, n) #define REPE(v, n) FORE(v, 0, n) #define REV(v, a, b) for(int v = (a); v >= (b); --v) #define ALL(x) (x).begin(), (x).end() #define LLI long long int using namespace std; template using V = vector; template using P = pair; template void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<> n; vector a(n+1), b(n+1); REPE(i,n) cin >> a[i]; REPE(i,n) cin >> b[i]; vector bsum(n+1, b[0]); FORE(i,1,n) (bsum[i] = bsum[i-1] + b[i]) %= mod; LLI ans = 0; REPE(i,n) (ans += a[i] * bsum[n-i]) %= mod; cout << ans << endl; return 0; }