#include #include using namespace atcoder; using mint = modint1000000007; using namespace std; #define rep(i,n) for(int i=0;i>N; vector A(N); rep(i,N){ cin>>A[i]; S+=A[i]; } bool f=true; if(S%N!=0)f=false; else{ S/=N; rep(i,N-1){ if(A[i]>S)f=false; else A[i+1]-=S-A[i]; } if(A[N-1]!=S)f=false; } YN(f); }