#include <bits/stdc++.h>
using namespace std;
int n, mx, mxx, i, a[200005];
long long ans[200005];
bool flag = true;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++)
    if (mx < a[i] && a[i] != a[(i + n - 2) % n + 1]) {
      mx = a[i];
      mxx = i;
    }
  for (i = 1; i <= n; i++)
    if (a[i] != a[1]) break;
  if (i > n)
    if (a[1] == 0) {
      printf("YES\n");
      for (i = 1; i <= n; i++) printf("1 ");
      return 0;
    } else {
      printf("NO");
      return 0;
    }
  printf("YES\n");
  ans[mxx] = a[mxx];
  for (i = mxx - 1; i >= 1; i--) {
    ans[i] = ans[i + 1] + a[i];
    if (a[i] == 0 && flag) {
      ans[i] *= 2;
      flag = false;
    }
  }
  ans[n + 1] = ans[1];
  for (i = n; i > mxx; i--) {
    ans[i] = ans[i + 1] + a[i];
    if (a[i] == 0 && flag) {
      ans[i] *= 2;
      flag = false;
    }
  }
  for (i = 1; i <= n; i++) printf("%I64d ", ans[i]);
}
