#include <bits/stdc++.h>
const int maxn = 140600;
int n, b[maxn], m;
long long a[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", b + i), b[i] > m ? m = b[i] : 1;
  int i = 0;
  while (i < n && (b[(i + n - 1) % n] == m || b[i] != m)) i++;
  if (i == n) {
    if (m) return puts("NO"), 0;
    for (i = 0; i < n; i++) a[i] = 1;
  } else
    for (int j = n; j; j--) {
      int x = b[(i + j) % n];
      if (j == n - 1 && !x) x = a[i];
      a[(i + j) % n] = x + (j < n ? a[(i + j + 1) % n] : 0);
    }
  puts("YES");
  for (int i = 0; i < n; i++) printf("%lld%c", a[i], " \n"[i == n - 1]);
}
