#include <bits/stdc++.h>
using namespace std;
int n, ok = 1;
long long b[200007], a[200007];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    if (b[i] != 0) ok = 0;
  }
  if (ok) {
    cout << "YES\n";
    for (int i = 1; i <= n; i++) cout << 925 << " ";
    return 0;
  }
  int pos = -1;
  for (int i = 0; i < n; i++) {
    if (b[i] > b[(i - 1 + n) % n]) {
      pos = i;
      break;
    }
  }
  if (pos == -1) {
    cout << "NO";
    return 0;
  }
  a[pos] = b[pos];
  for (int i = (pos - 1 + n) % n; i != pos; i = (i - 1 + n) % n) {
    int prv = (i + 1) % n;
    long long cl = b[(i - 1 + n) % n];
    if (a[prv] + b[i] > cl)
      a[i] = a[prv] + b[i];
    else {
      cl -= a[prv] + b[i];
      a[i] = a[prv] + b[i] + a[prv] * (cl / a[prv] + 1 + (cl % a[prv] != 0));
    }
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) cout << a[i] << " ";
}
