#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  register long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const long long N = 140582 + 10;
long long n, a[N], b[N], mxp = -1, mxv;
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) a[i] = b[i] = read();
  a[0] = b[0] = b[n];
  mxv = *max_element(b + 1, b + n + 1);
  for (long long i = 1; i <= n; i++)
    if (b[i] == mxv && b[i - 1] < mxv) {
      mxp = i;
      break;
    }
  if (mxp == -1) {
    if (!mxv) {
      puts("YES");
      for (long long i = 1; i <= n; i++) cout << 1 << ' ';
    } else
      puts("NO");
    return 0;
  }
  a[((mxp - 1 + n) % n == 0 ? n : (mxp - 1 + n) % n)] += mxv;
  for (long long i = 1; i < n; i++)
    a[((mxp - i + n) % n == 0 ? n : (mxp - i + n) % n)] +=
        a[((mxp - i + 1 + n) % n == 0 ? n : (mxp - i + 1 + n) % n)];
  puts("YES");
  for (long long i = 1; i <= n; i++) cout << a[i] << ' ';
}
