#include <bits/stdc++.h>
using namespace std;
int n;
long long b[150005];
long long a[150005];
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
  }
  bool flag = true;
  for (int i = 1; i < n; i++) {
    if (b[i] != b[0]) flag = false;
  }
  if (flag) {
    printf("%s\n", b[0] == 0 ? "YES" : "NO");
    if (b[0] == 0) {
      for (int i = 0; i < n; i++) {
        printf("%d%c", 1, i + 1 == n ? '\n' : ' ');
      }
    }
  } else {
    printf("YES\n");
    int v = 0;
    for (int i = 0; i < n; i++) {
      if (b[i] >= b[v] && b[i] > b[(i + n - 1) % n]) {
        v = i;
      }
    }
    long long sum = b[v] * 2LL;
    a[v] = b[v];
    for (int i = n - 1; i >= 1; i--) {
      sum += b[(v + i) % n];
      a[(v + i) % n] = sum;
    }
    for (int i = 0; i < n; i++) {
      printf("%lld%c", a[i], i + 1 == n ? '\n' : ' ');
    }
  }
  return 0;
}
