#include <bits/stdc++.h>
using namespace std;
long long n, a[200100], b[200100];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int mxpos = 0;
  int mnpos = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > a[mxpos]) {
      mxpos = i;
    }
    if (a[i] < a[mnpos]) {
      mnpos = i;
    }
  }
  if (a[mxpos] == a[mnpos]) {
    if (a[mxpos] != 0) return cout << "NO", 0;
    cout << "YES\n";
    for (int i = 0; i < n; i++) cout << 1 << ' ';
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == a[mxpos] && a[(i - 1 + n) % n] != a[i]) {
      mxpos = i;
    }
  }
  b[mxpos] = a[mxpos];
  for (int i = 1; i < n; i++) {
    int pos = (mxpos - i + n) % n;
    int pr_pos = (pos + 1) % n;
    b[pos] = a[pos];
    b[pos] += b[pr_pos];
    if (i == 1) b[pos] += b[pr_pos];
  }
  cout << "YES\n";
  for (int i = 0; i < n; i++) cout << b[i] << ' ';
}
