#include using namespace std; #define fi first #define se second #define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++) #define rep(i,n) repl(i,0,n) #define each(itr,v) for(auto itr:v) #define pb(s) push_back(s) #define mp(a,b) make_pair(a,b) #define all(x) (x).begin(),(x).end() #define dbg(x) cout<<#x"="<(x).count() typedef long long ll; typedef unsigned long long ull; typedef pair P; typedef pair PPI; typedef pair PL; typedef pair PPL; #define INF INT_MAX/3 #define MAX_N 1000 ll b[111111]; ll a[111111]; int n; int main(){ cin.sync_with_stdio(false); cin>>n; rep(i,n)cin>>b[i]; a[0]=1; repl(i,1,n+1){ if(i%2==1){ a[i]=b[i-1]-a[i-1]; }else{ a[i]=a[i-1]-b[i-1]; } } rep(i,n+1){ if(a[i]<=0){ cout<<-1<