#include <bits/stdc++.h>
using namespace std;
int n;
long long Max;
long long a[141000], b[141000], c[141000];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &b[i]);
    Max = max(Max, b[i]);
    c[i] = b[i];
  }
  int pos;
  for (int i = 1; i <= n; i++)
    if (b[i] == Max && b[i - 1] != b[i]) pos = i;
  if (!Max) {
    printf("YES\n");
    for (int i = 1; i <= n; i++) printf("1 ");
    return 0;
  }
  a[pos] = b[pos];
  int pre = (pos == 1) ? n : pos - 1;
  if (!b[pre]) c[pre] = c[pos];
  for (int i = pos - 1; i > 0; i--) a[i] = a[i + 1] + c[i];
  for (int i = n; i > pos; i--) a[i] = a[i % n + 1] + c[i];
  for (int i = 1; i <= n; i++)
    if ((!a[i % n + 1]) || (a[i] % a[i % n + 1] != b[i])) return !printf("NO");
  printf("YES\n");
  for (int i = 1; i <= n; i++) printf("%lld ", a[i]);
  return 0;
}
