#include <bits/stdc++.h>
using namespace std;
const int BUF = 141000;
int nVal, val[BUF];
void read() {
  cin >> nVal;
  for (int i = 0; i < nVal; ++i) {
    cin >> val[i];
  }
}
int next(int pos) { return (pos + 1) % nVal; }
int prev(int pos) { return (pos - 1 + nVal) % nVal; }
int getPrevNonZeroIdx(int pos, int v[BUF]) {
  pos = prev(pos);
  while (v[pos] == 0) pos = prev(pos);
  return pos;
}
void work() {
  int maxPos = max_element(val, val + nVal) - val;
  if (val[maxPos] == 0) {
    cout << "YES" << endl;
    for (int i = 0; i < nVal; ++i) {
      if (i) cout << ' ';
      cout << 1;
    }
    cout << endl;
    return;
  }
  if (count(val, val + nVal, val[maxPos]) == nVal) {
    cout << "NO" << endl;
    return;
  }
  for (int i = 0; i < nVal; ++i) {
    if (val[i] == val[maxPos] && val[prev(i)] < val[i]) {
      maxPos = i;
    }
  }
  long long ans[BUF];
  ans[maxPos] = val[maxPos];
  for (int loop = 0, idx = prev(maxPos); loop < nVal - 1;
       ++loop, idx = prev(idx)) {
    if (val[idx] == 0) {
      ans[idx] = ans[next(idx)] * (val[prev(idx)] == ans[next(idx)] ? 2 : 1);
    } else if (val[getPrevNonZeroIdx(idx, val)] < val[idx]) {
      ans[idx] = val[idx];
    } else {
      int diff = val[getPrevNonZeroIdx(idx, val)] - val[idx];
      long long assign =
          val[idx] + 1LL * (diff / ans[next(idx)] + 1) * ans[next(idx)];
      ans[idx] = assign;
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < nVal; ++i) {
    if (i) cout << ' ';
    cout << ans[i];
  }
  cout << endl;
}
int main() {
  read();
  work();
  return 0;
}
