#include <bits/stdc++.h>
using namespace std;
const long long N = 1001 * 1001, MOD = 1e9 + 7;
long long a[N], ans[N];
long long n;
long long prv(long long x) { return (x - 1 + n) % n; }
long long nxt(long long x) { return (x + 1) % n; }
int32_t main() {
  ios::sync_with_stdio(0);
  cin >> n;
  long long s = 0;
  for (long long i = 0; i < n; i++) cin >> a[i], s += a[i];
  if (!s) {
    cout << "YES\n";
    for (long long i = 0; i < n; i++) cout << 1 << ' ';
    cout << endl;
    return 0;
  }
  long long id = -1;
  a[n] = a[0];
  for (long long i = 0; i < n; i++)
    if (a[i] < a[i + 1]) id = nxt(i);
  if (id == -1) return cout << "NO" << endl, 0;
  ans[id] = a[id];
  ans[prv(id)] = MOD * a[id] + a[prv(id)];
  for (long long j = prv(prv(id)); j != id; j = prv(j))
    ans[j] = ans[nxt(j)] + a[j];
  cout << "YES\n";
  for (long long i = 0; i < n; i++) cout << ans[i] << ' ';
  cout << endl;
}
