#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  long long mx = 0;
  vector<long long> b(n);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &b[i]);
    mx = max(mx, b[i]);
  }
  int k = -1;
  for (int i = 0; i < n; i++)
    if (b[i] == mx && b[(i - 1 + n) % n] < mx) {
      k = i;
      break;
    }
  if (k == -1) {
    if (mx == 0) {
      printf("YES\n");
      for (int i = 0; i < n; i++) printf("1 ");
    } else
      printf("NO\n");
    return 0;
  }
  vector<long long> a(n);
  a[k] = b[k];
  int pos = (k - 1 + n) % n;
  a[pos] = a[(pos + 1) % n] * 10000000 + b[pos];
  for (int i = 2; i < n; i++) {
    pos = (k - i + n) % n;
    a[pos] = a[(pos + 1) % n] + b[pos];
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) printf("%I64d ", a[i]);
  return 0;
}
