#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> b(n);
  long long mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    mx = max(mx, b[i]);
  }
  vector<long long> a(n);
  if (mx == 0) {
    fill(a.begin(), a.end(), 1);
  } else {
    int start = -1;
    for (int i = 0; i < n; i++) {
      if (b[i] != mx && b[(i + 1) % n] == mx) {
        start = (i + 1) % n;
        break;
      }
    }
    if (start == -1) {
      cout << "NO" << '\n';
      return 0;
    } else {
      a[start] = b[start];
      int nxt = (start - 1 + n) % n;
      if (b[nxt] == 0)
        a[nxt] = a[start] * 2;
      else
        a[nxt] = a[start] + b[nxt];
      for (int cur = nxt; cur != start; cur = nxt) {
        nxt = (cur - 1 + n) % n;
        if (nxt != start) {
          a[nxt] = a[cur] + b[nxt];
        }
      }
    }
  }
  cout << "YES" << '\n';
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << '\n';
  return 0;
}
