#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) using ll = long long; typedef pair pint; typedef pair pli; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1e9+7 ; int main(){ int n; cin >> n; int a[n], b[n], sa[n]; rep(i, n){ cin >> a[i]; } rep(i, n){ cin >> b[i]; } int sum = 0; rep(i, n){ sa[i] = a[i]-b[i]; sum+=sa[i]; } bool can = true; if(sum%(n-2)!=0) can = false; //cout << can << endl; rep(i, n-1){ if(abs(sa[i])%2!=abs(sa[i+1])%2) can=false; } sort(sa, sa+n, greater<>()); int kai[n]; kai[0] = 0; int k = 0; rep(i, n-1){ kai[i+1] = kai[i]+(sa[i]-sa[i+1])/2; k+=kai[i+1]; } if(k>sum/(n-2)) can=false; if(can) cout << "Yes" << endl; else cout << -1 << endl; }