Wrong Answer.wrong answer On line 1 column 1, read 8, expected 1
#include <iostream>
using namespace std;
const int MAXN = 100005;
typedef long long ll;
ll a[MAXN] , b[MAXN] , m , t;
inline ll mul(ll a, ll b, ll p){return ( (a * (b>>32LL)%p * (1LL<<32)%p) + (a * (b&((1LL << 32) - 1))%p) ) %p;}
//inline ll mul(ll a,ll b,ll p){ll ans=0;while(b){if(b&1)ans = (ans + a) % p , a = (a + a) % p , b /= 2;}return ans;}
inline ll fastpow(ll a,ll b,ll c){if(b==0)return 1%c;ll ans=1,t=a;while(b>0){if(b%2==1) ans=ans*t%c;b/=2; t=t*t%c;}return ans;}
ll exgcd(ll a,ll b,ll &x,ll &y){
if(b==0){x = 1 , y = 0;return a;}
ll x1, y1 , g = exgcd(b,a%b,x1,y1);
x = y1 , y = x1 - a / b * y1;
return g;
}inline ll inv(ll a,ll b){ll x , y;exgcd(a,b,x,y);return (x%b+b)%b;}
int main(){ll M =1 , ans = 0;
ll n;cin>>n;for(ll i = 1;i<=n;++i)scanf("%lld",&a[i]);
for(ll i = 1;i<=n;++i)scanf("%lld",&b[i]) , M *= b[i] , a[i] = ((a[i]%b[i])+b[i])%b[i];
for(ll i = 1;i<=n;++i)m = M / b[i] , t = inv(m,b[i]) , ans = (ans + mul(a[i] , mul(m,t,M),M))%M;
cout<<(ans+M)%M;return 0;
}