#include <bits/stdc++.h>
using namespace std;
int n, ind;
long long a[200005], b[200005], maxn = -1;
bool flag;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &b[i]);
  for (int i = 1; i < n; i++) {
    if (b[i] != b[i + 1]) {
      flag = 1;
      break;
    }
  }
  if (!flag) {
    if (b[1] == 0) {
      printf("YES\n");
      for (int i = 1; i < n; i++) printf("1 ");
      printf("1\n");
      return 0;
    } else {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
  for (int i = 1; i <= n; i++) {
    if (maxn < b[i]) {
      maxn = b[i];
      ind = i;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (b[i] == maxn) {
      int j = i - 1;
      if (j < 0) j = n;
      if (b[j] < b[i]) ind = i;
    }
  }
  a[ind] = b[ind];
  for (int i = n; i > 1; i--) {
    ind--;
    if (ind <= 0) ind = n;
    int j = ind + 1;
    if (j > n) j = 1;
    for (int k = 0;; k++) {
      if (b[ind] + a[j] * k > b[ind - 1 <= 0 ? n : ind - 1]) {
        a[ind] = b[ind] + a[j] * k;
        break;
      }
    }
  }
  for (int i = 1; i < n; i++) printf("%lld ", a[i]);
  printf("%lld\n", a[n]);
}
