#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 150007;
int n;
long long a[MAXN];
int b[MAXN];
void init();
void input();
void work();
int nxt(int i) { return (i + 1 <= n) ? (i + 1) : 1; }
int prv(int i) { return (i - 1 > 0) ? (i - 1) : n; }
int main() {
  init();
  input();
  work();
}
void init() { ios::sync_with_stdio(false); }
void input() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &b[i]);
}
void work() {
  int mx = *max_element(b + 1, b + 1 + n);
  if (!mx) {
    printf("YES\n");
    for (int i = 1; i <= n; ++i) printf("1 ");
    putchar('\n');
    return;
  }
  int np = -1;
  for (int i = 1; i <= n; ++i) {
    if (b[i] ^ mx) {
      np = i;
      break;
    }
  }
  if (np == -1) {
    printf("NO\n");
    return;
  }
  for (; b[np] ^ mx; np = nxt(np))
    ;
  a[np] = b[np];
  for (int i = prv(np); i ^ np; i = prv(i)) {
    while (b[i] >= a[nxt(i)]) a[nxt(i)] += a[nxt(nxt(i))];
    a[i] = a[nxt(i)] + b[i];
  }
  while (b[np] >= a[nxt(np)]) a[nxt(np)] += a[nxt(nxt(np))];
  printf("YES\n");
  for (int i = 1; i <= n; ++i) printf("%I64d ", a[i]);
  putchar('\n');
}
