#include <bits/stdc++.h>
using namespace std;
const int N = 140600;
long long n, a[N], b[N];
int main() {
  scanf("%I64d", &n);
  int start_pos = -1, mx = -1;
  bool same = true;
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &b[i]);
    if (mx < b[i]) {
      mx = b[i];
      start_pos = i;
    }
    if (b[i] != b[0]) same = false;
  }
  for (int i = n - 1; i >= 0; i--) {
    if (b[i] == mx)
      start_pos = i;
    else
      break;
  }
  if (same) {
    if (mx != 0)
      puts("NO");
    else {
      puts("YES");
      for (int i = 0; i < n; i++) printf("1 ");
      puts("");
    }
  } else {
    puts("YES");
    long long s = 0;
    a[start_pos] = b[start_pos];
    for (int i = 1; i < n; i++) {
      s += b[(start_pos - i + n) % n];
      a[(start_pos - i + n) % n] = s + 2 * b[start_pos];
    }
    for (int i = 0; i < n; i++) printf("%I64d ", a[i]);
    puts("");
  }
  return 0;
}
