#include <bits/stdc++.h>
using namespace std;
template <class T, class T2>
inline int chkmax(T &x, const T2 &y) {
  return x < y ? x = y, 1 : 0;
}
template <class T, class T2>
inline int chkmin(T &x, const T2 &y) {
  return x > y ? x = y, 1 : 0;
}
const int MAXN = (1 << 20);
int n;
int b[MAXN];
int mn = MAXN, mx = -1;
void read() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    chkmax(mx, b[i]);
    chkmin(mn, b[i]);
  }
}
void solve() {
  if (mx == mn) {
    if (mx != 0) {
      cout << "NO" << '\n';
      return;
    }
    cout << "YES" << '\n';
    for (int i = 0; i < n; i++) cout << 1 << " ";
    cout << '\n';
    return;
  }
  vector<int64_t> a(n, 0);
  int p = -1;
  for (int i = 0; i < n; i++)
    if (b[i] < b[(i + 1) % n]) {
      a[(i + 1) % n] = b[(i + 1) % n], p = (i + 1) % n;
      break;
    }
  for (int j = n - 1, i = (p - 1 + n) % n; j > 0; j--, i = (i - 1 + n) % n) {
    if (j == n - 1)
      a[i] = a[(i + 1) % n] * 1000000ll + b[i];
    else
      a[i] = a[(i + 1) % n] + b[i];
  }
  cout << "YES" << '\n';
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  read();
  solve();
  return 0;
}
