#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
typedef long long ll;

cs int N = 1e6 + 5; 

int n; bool o[N];
ll w[N], v[N], d[N], a[N];

int main() {
	#ifdef FSYo
	freopen("1.in", "r", stdin);
	#endif
	cin >> n >> w[1];
	for(int i = 1; i <= n - 2; i++) 
		scanf("%lld", &w[i]);
	ll L = 0, R = w[1];
	set<ll> S; 
	o[1] = 1; 
	ll k = 1, b = 0; 
	for(int i = 2; i <= n - 2; i++) {
//		cout << i << ' ' << w[i] << " " << L << ' ' << R << endl;
//		for(ll z : S) cout << k * z + b << ' '; cout << endl;
		bool in = 0; 
		in |= L <= w[i] && w[i] <= R; 
		// k * x + b = w -> x = (w - b) * k
		auto z = S.find((w[i] - b) * k);
		if(z != S.end()) in = true; 
		if(in) {
			o[i] = true;
			S.clear();
			k = 1, b = 0; 
			L = 0, R = w[i];
			continue; 
		}
		if(L <= R && L > w[i]) 	
			L = -1, R = -2; 
		z = S.begin(); 
		while(z != S.end()) {
			ll p = k * (*z) + b; 
			if(p > w[i]) S.erase(z++);
			else break;
		}
		if(S.size()) {
			z = -- S.end();
			while(z != S.end()) {
				ll p = k * (*z) + b; 
				if(p > w[i]) S.erase(z--);
				else break;
			}
		}
		if(L > R && S.empty())
			return puts("NO"), 0;
		
		if(L <= R) 
			v[i] = L; 
		else 	
			v[i] = k * (*S.begin()) + b;
			
		if(L <= R) {
			L = w[i] - L, R = w[i] - R;
			swap(L, R);
		}
		k = -k, b = w[i] - b;
		S.insert((w[i] - b) * k);
	}
	if(L <= R) d[n - 1] = L;
	else d[n - 1] = k * (*S.begin()) + b; 
	for(int i = n - 2; i; i--) {
		if(o[i]) d[i] = w[i];
		else {
			if(d[i + 1] == w[i]) d[i] = v[i];
			else d[i] = w[i] - d[i + 1];
		}
	} 
	for(int i = 2; i < n; i++) {
		if(abs(d[i - 1]) == w[i - 1] || d[i] == w[i - 1]) {
			if(d[i - 1] > 0) d[i] = - d[i];
		}
		else if(d[i - 1] < 0) d[i] = - d[i];
	} 
	for(int i = 1; i < n; i++) 
		a[i] = a[i - 1] + d[i];
	ll mn = a[0];
	for(int i = 1; i < n; i++)
		mn = min(mn, a[i]);
	puts("YES");
	for(int i = 0; i < n; i++)
		cout << a[i] - mn << ' ';
		
	for(int i = 2; i < n; i++) {
		ll mx = max({a[i - 2], a[i - 1], a[i]});
		ll mn = min({a[i - 2], a[i - 1], a[i]});
		assert(mx - mn == w[i - 1]);
	}
	return 0; 
}