#include <bits/stdc++.h>
using namespace std;
const int MAXN = 150000;
long long n, a[MAXN], mn[MAXN], b[MAXN], sum;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum == 0) {
    cout << "YES" << '\n';
    for (int i = 0; i < n; ++i) cout << 1 << " ";
    cout << '\n';
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    mn[i] = max(a[(i - 1 + n) % n] + 1, a[i]);
  }
  int t;
  for (int i = 0; i < n; i = t) {
    int j = i;
    while (a[(j - 1 + n) % n] >= a[j] && j < n - 1) ++j;
    t = j + 1;
    if (j == n - 1 && a[j - 1] >= a[j]) {
      if (i == 0) {
        cout << "NO" << '\n';
        return 0;
      }
      if (b[0] + a[j] >= mn[j])
        b[j] = b[0] + a[j];
      else {
        b[j] = mn[j] / b[0] * b[0];
        b[j] += a[j];
        if (b[j] < mn[j]) b[j] += b[0];
      }
    } else {
      b[j] = mn[j];
      mn[j + 1] = max(mn[j + 1], b[j] + 1);
    }
    --j;
    while (j >= i) {
      b[j] = b[j + 1] + a[j];
      if (b[j] < mn[j]) {
        b[j] = mn[j] / b[j + 1] * b[j + 1];
        b[j] += a[j];
        if (b[j] < mn[j]) b[j] += b[j + 1];
      }
      --j;
    }
  }
  cout << "YES" << '\n';
  for (int i = 0; i < n; ++i) cout << b[i] << " ";
  cout << '\n';
}
