#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, v, inx = 0;
  long long s = 0;
  bool t = 0;
  vector<long long> a;
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%d", &v);
    a.push_back(v);
    if (i > 0 && v != a[i - 1]) t = 1;
    if (v > a[inx]) inx = i;
  }
  for (i = 0; i < n; i++) {
    if (a[i] == a[inx] &&
        ((i == 0 && a[0] > a[n - 1]) || (i > 0 && a[i] > a[i - 1]))) {
      inx = i;
      break;
    }
  }
  if (!t && a[0] == 0) {
    cout << "YES\n";
    for (i = 0; i < n; i++) cout << 1 << " ";
    return 0;
  }
  if (!t)
    cout << "NO";
  else {
    cout << "YES\n";
    v = a[inx];
    for (j = inx - 1; j >= 0; j--) {
      s += a[j];
      a[j] = s + 2 * v;
    }
    for (j = n - 1; j > inx; j--) {
      s += a[j];
      a[j] = s + 2 * v;
    }
    for (i = 0; i < n; i++) cout << a[i] << " ";
  }
  return 0;
}
