#include <bits/stdc++.h>
#define T ll tt ; cin>>tt ; while(tt--)
#define fast ios::sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
#define endl '\n'
#define yes void (cout << "YES" << endl)
#define no void (cout << "NO" << endl)
#define pb push_back
#define F first
#define S second
#define ld long double
#define fixed(g) fixed<<setprecision(g)
#define ll long long
using namespace std;
const ll N = 2e6 + 9 ;
const ll oo = 1e9 + 7 ;
ll n , m , k , x , y , z , g , ans , sum , sum2 , cnt , dis[N] , sz , mn , a[N] , b[N] ;
bool ff , vis[N] ;
vector<pair<ll , ll> >v[N] ;
int main(){
fast
sum = 0 ;
cin >> n ;
for(ll i=0 ; i<n ; i++)cin >> a[i] ;
for(ll i=0 ; i<n ; i++){
cin >> b[i] ;
sum +=b[i];
sum%=oo;
x%=oo
}
a[n] = -1 , b[n] = -1 ;
for(ll i=0 ; i<n ; i++){
if(a[i]==a[i+1]){
x +=b[i] ;
}
else {
x +=b[i] ;
sum%=oo;
y = sum*(sum+1) ;
z = a[i]*(a[i]+1);
y/=2;
z/=2;
y%=oo;
z%=oo;
ans += x * y ;
ans%=oo;
x%=oo;
sum -= x ;
x = 0 , y = 0 , z = 0 ;
}
}
cout << ans << endl ;
return 0 ;
}
Compilation message
fancyfence.cpp: In function 'int main()':
fancyfence.cpp:28:14: error: expected ';' before '}' token
28 | x%=oo
| ^
| ;
29 | }
| ~