#include using namespace std; #include using namespace atcoder; // clang-format off #define REP(i, n) for(int i = 0; i < (n); i++) // [0, n): 0, 1,... ,n-1 #define rep(i, l, r) for(int i = l; i < (r); i++) // [l, r): l, l+1,... ,r-1 #define rrep(i, r, l) for(int i = r; i >= (l); i--) // [l, r]: r, r-1,... ,l #define ALL(v) (v).begin(), (v).end() #define endl "\n" using ll = long long; using P = pair; using vl = vector; using vvl = vector>; istream& operator>>(istream& is, vl& vec) {for(auto& e: vec)is>>e; return (is);} constexpr ll INF = 1e18; template bool chmax(T &a, const T &b) {if(a < b) {a = b;return true;}return false;} template bool chmin(T &a, const T &b) {if (b < a) {a = b;return true;}return false;} ll ceil_div(ll a, ll b){ return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } /* Mod Int from atcoder library */ using mint = atcoder::modint1000000007; // using mint = atcoder::modint998244353; istream& operator>>(istream& is, mint& p) {long long t;is >> t;p = mint(t); return (is);} ostream& operator<<(ostream& os, const mint& p) { return os << p.val(); } // clang-format on int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); ll n;cin>>n; vl a(n+1), b(n+1); cin >> a;cin>>b; auto c= atcoder::convolution_ll(a,b); mint ans=0; REP(i,n+1)ans+=c[i]; cout << ans << endl; return 0; }