#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n;cin >> n;
vector<long long> h(n);
vector<long long> w(n);
for(int i = 0;i<n;i++){
cin >> h[i];
}
for(int i = 0;i<n;i++){
cin >> w[i];
}
//Subtask 1 : width is all equal to 1, that means they are all like towers
//formula : w(w+1)h(h+1) / 4;
//subtask 3 : all hi are equal
long long totalwidth = 0;
for(int i = 0;i<n;i++){
totalwidth += w[i] ;
}
long long n1 = totalwidth * (totalwidth + 1) % MOD;
long long n2 = h[0] *(h[0] + 1) % MOD;
long long ans = ((n1 * n2) /4) % MOD;
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |