#include <bits/stdc++.h>
using namespace std;
const int maxn = 150000;
int b[maxn];
long long a[maxn];
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  b[0] = b[n];
  int id = 0;
  for (int i = 1; i <= n; i++)
    if (b[i] > b[i - 1]) {
      id = i;
      break;
    }
  if (id == 0) {
    if (b[1] == 0) {
      printf("YES\n");
      for (int i = 1; i <= n; i++) printf("1%c", " \n"[i == n]);
    } else
      printf("NO\n");
    return 0;
  }
  a[id] = max(b[id], 1);
  for (int i = 0; i < n - 1; i++) {
    int nid = id - 1;
    if (nid == 0) nid = n;
    int nnid = nid - 1;
    if (nnid == 0) nnid = n;
    a[nid] = b[nid];
    if (b[nnid] >= b[nid]) a[nid] += ((b[nnid] - b[nid]) / a[id] + 1) * a[id];
    if (a[nid] == 0) a[nid] = a[id];
    id = nid;
  }
  a[n + 1] = a[1];
  printf("YES\n");
  for (int i = 1; i <= n; i++) printf("%I64d%c", a[i], " \n"[i == n]);
  return 0;
}
