#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 5;
const long long mod = 1e9 + 9;
long long cel(long long n, long long r) { return (n + r - 1) / r; }
long long pw(long long b, long long r, long long md = mod) {
  b = b % md;
  long long ans = 1;
  while (r) {
    if (r & 1) ans = (ans * b) % md;
    b = (b * b) % md;
    r >>= 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long T = 1;
  while (T--) {
    long long n;
    cin >> n;
    long long arr[n];
    for (long long i = 0; i <= n - 1; ++i) cin >> arr[i];
    long long mx = 0;
    for (long long i = 0; i <= n - 1; ++i) mx = max(mx, arr[i]);
    if (mx == 0) {
      cout << "YES" << '\n';
      for (long long i = 0; i <= n - 1; ++i) cout << "1 ";
      cout << '\n';
      continue;
    }
    long long ind = -1;
    for (long long i = 0; i <= n - 1; ++i) {
      if (arr[i] != mx && arr[(i + 1) % n] == mx) {
        ind = i;
        break;
      }
    }
    if (ind == -1) {
      cout << "NO" << '\n';
      continue;
    }
    long long ans[n];
    memset(ans, 0, sizeof ans);
    ;
    ind++;
    ind %= n;
    for (long long i = 0; i <= n - 1; ++i) {
      if (i == 0) {
        ans[ind] = mx;
        ind--;
        if (ind < 0) ind += n;
        continue;
      }
      if (i == 1) {
        ans[ind] = 2 * ans[(ind + 1) % n] + arr[ind];
        ind--;
        if (ind < 0) ind += n;
        continue;
      }
      ans[ind] = ans[(ind + 1) % n] + arr[ind];
      ind--;
      if (ind < 0) ind += n;
      continue;
    }
    cout << "YES" << '\n';
    for (long long i = 0; i <= n - 1; ++i) cout << ans[i] << " ";
    cout << '\n';
  }
  return 0;
}
