#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)(1e9 + 7);
long long modpow(long long a, long long b) {
  if (!b) return 1;
  a %= mod;
  return modpow(a * a % mod, b / 2) * (b & 1 ? a : 1) % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long b[n];
  for (int i = 0; i < n; i++) cin >> b[i];
  long long M = 0;
  for (int i = 0; i < n; i++) M = max(M, b[i]);
  bool term = true;
  for (int i = 0; i < n; i++)
    if (b[i] != M) term = false;
  if (term) {
    if (M)
      cout << "NO" << endl;
    else {
      cout << "YES" << endl;
      for (int i = 0; i < n; i++) cout << "1 ";
      cout << endl;
    }
    return 0;
  }
  int j = 0;
  for (int i = 0; i < n; i++)
    if (b[i] == M && b[(i - 1 + n) % n] != M) j = i;
  long long a[n];
  for (int i = 0; i < n; i++) a[i] = b[i];
  for (int i = 0; i < n; i++)
    if (i) {
      int cur = (j - i + n) % n;
      int prev = (j - i + 1 + n) % n;
      a[cur] += a[prev];
      if (i == 1) a[cur] += b[j];
    }
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) cout << a[i] << " ";
  cout << endl;
  return 0;
}
