#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
  int n;
  scanf("%d", &n);
  int b[150000];
  vector<int> v;
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
    if (b[i]) v.push_back(b[i]);
  }
  LL a[150000];
  LL first = 1e9;
  if (b[0] > b[n - 1]) {
    a[n - 1] = b[0] * first + b[n - 1];
    for (int i = n - 2; i > 0; i--) {
      a[i] = b[i] + a[i + 1];
    }
    a[0] = b[0];
  } else {
    int ok = 0;
    for (int i = 0; i < n; i++) {
      if (b[i] < b[i + 1]) {
        ok = 1;
        a[i + 1] = b[i + 1];
        a[i] = b[i + 1] * first + b[i];
        for (int j = i - 1; j >= 0; j--) {
          a[j] = a[j + 1] + b[j];
        }
        for (int j = n - 1; j > i + 1; j--) {
          a[j] = a[(j + 1) % n] + b[j];
        }
        break;
      }
    }
    if (!ok) {
      if (b[0] == 0) {
        printf("YES\n");
        for (int i = 0; i < n; i++) printf("1 ");
        printf("\n");
      } else
        printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) {
    printf("%lld ", a[i]);
  }
  printf("\n");
}
