#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int a[N];
long long ans[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  bool nonZero = false;
  int mx = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    mx = max(mx, a[i]);
    if (a[i] != 0) {
      nonZero = true;
    }
  }
  if (!nonZero) {
    cout << "YES" << endl;
    for (int i = 1; i <= n; ++i) {
      cout << "1"
           << " ";
    }
    return 0;
  }
  int idx = -1;
  for (int i = 1; i <= n; ++i) {
    int prv = i - 1, nxt = i + 1;
    if (nxt > n) {
      nxt = 1;
    }
    if (prv < 1) {
      prv = n;
    }
    if (a[i] > a[prv]) {
      idx = i;
      break;
    }
  }
  if (idx == -1) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
    ans[idx] = a[idx];
    int cur = idx;
    for (int i = 1; i <= n - 1; ++i) {
      int prv = cur - 1;
      if (prv < 1) {
        prv = n;
      }
      if (i == 1) {
        int k = (mx - a[prv]) / ans[cur] + 1;
        ans[prv] = k * 1ll * ans[cur] + a[prv];
      } else {
        ans[prv] = ans[cur] + a[prv];
      }
      cur = prv;
    }
    for (int i = 1; i <= n; ++i) {
      cout << ans[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
