#include <bits/stdc++.h>
const int N = 2e5 + 10;
int main() {
  int n, pos, nxt;
  long long int a[N];
  bool f = false;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i < n; i++)
    if (a[i] != a[i - 1]) {
      f = true;
      break;
    }
  if (f) {
    pos = 0;
    for (int i = 1; i < n; i++)
      if (a[i] > a[pos]) pos = i;
    while (true) {
      nxt = (pos - 1 + n) % n;
      if (a[nxt] == a[pos])
        pos = nxt;
      else
        break;
    }
    for (int i = 1; i < n; i++) {
      if (f && a[(pos - i + n) % n] == 0) {
        a[(pos - i + n) % n] += a[(pos - i + 1 + n) % n];
        f = false;
      }
      a[(pos - i + n) % n] += a[(pos - i + 1 + n) % n];
    }
    printf("YES\n%lld", a[0]);
    for (int i = 1; i < n; i++) printf(" %lld", a[i]);
    printf("\n");
  } else {
    if (a[0] == 0) {
      printf("YES\n1");
      for (int i = 1; i < n; i++) printf(" 1");
      printf("\n");
    } else
      printf("NO\n");
  }
}
