#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 10;
long long a[maxn], b[maxn], ans[maxn];
int32_t main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b, b + n);
  if (b[0] == b[n - 1]) {
    if (b[0] == 0) {
      cout << "YES" << '\n';
      for (long long i = 0; i < n; i++) cout << "1 ";
    } else
      cout << "NO";
    exit(0);
  }
  long long pos = -1, mx = b[n - 1];
  for (long long i = 0; i < n; i++) {
    if (a[i] == mx && a[(i - 1 + n) % n] != mx) pos = i;
  }
  ans[pos] = a[pos];
  bool bad = 1;
  for (long long i = (pos - 1 + n) % n; i != pos; i = (i - 1 + n) % n) {
    if (a[i] == 0 && bad)
      ans[i] = ans[(i + 1) % n] * 2LL, bad = 0;
    else
      ans[i] = ans[(i + 1) % n] + a[i];
  }
  cout << "YES" << '\n';
  for (long long i = 0; i < n; i++) cout << ans[i] << " ";
}
