#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000000000000000;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n;
  long long b[n];
  long long mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    mx = max(mx, b[i]);
  }
  long long x = -1;
  for (int i = 0; i < n; i++) {
    if (b[(i + n - 1) % n] < b[i]) {
      x = i;
    }
  }
  if (x == -1) {
    if (mx > 0) {
      cout << "NO";
      return 0;
    } else {
      cout << "YES" << endl;
      for (int i = 0; i < n; i++) {
        cout << "1 ";
      }
      return 0;
    }
  }
  long long a[n];
  a[x] = b[x];
  a[(x - 1 + n) % n] = b[x] * (mx + 1000) + b[(x - 1 + n) % n];
  long long t = (x - 2 + n) % n;
  while (t != x) {
    a[t] = a[(t + 1) % n] + b[t];
    t = (t - 1 + n) % n;
  }
  cout << "YES" << endl;
  for (auto i : a) {
    cout << i << " ";
  }
}
