#include <bits/stdc++.h>
int t1, t2, t3;
int n;
int b[200005];
long long a[200005];
long long sumb = 0;
bool good = 1;
int prev(int i) { return i ? i - 1 : n - 1; }
int stupid = 0;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", b + i);
    sumb += b[i];
  }
  if (sumb == 0) {
    printf("YES\n");
    for (int i = 0; i < n; i++) printf("1 ");
    return 0;
  }
  t1 = n - 1;
  while (b[prev(t1)] >= b[t1]) {
    t1 = prev(t1);
    stupid++;
    if (stupid > n) {
      printf("NO\n");
      return 0;
    }
  }
  a[t1] = b[t1];
  a[prev(t1)] = b[prev(t1)] + b[t1] * (long long)200000;
  t1 = prev(t1);
  for (int i = 0; i < n - 2; i++) {
    t2 = prev(t1);
    a[t2] = b[t2] + a[t1];
    t1 = t2;
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) printf("%I64d ", a[i]);
}
