#include <bits/stdc++.h>
long long MOD = 1e9 + 7;
using namespace std;
int main() {
  int n;
  cin >> n;
  long long b[410000];
  long long m = 0, mem;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    m = max(m, b[i]);
    if (b[i] == m) mem = i;
  }
  for (int i = n - 1; i >= 0; i--)
    if (b[i] == m) mem = i;
  int flag = 1;
  for (int i = 0; i < n; i++) {
    if (b[i] != m) flag = 0;
  }
  if (flag && m) {
    cout << "NO";
    return 0;
  } else if (flag) {
    cout << "YES" << endl;
    for (int i = 0; i < n; i++) cout << 1 << " ";
    return 0;
  }
  cout << "YES" << endl;
  long long a[410000] = {};
  a[mem] = b[mem];
  if (mem == 0 && b[n - 1] == m) {
    mem = n - 1;
    while (b[mem] == m) mem--;
    mem++;
    a[mem] = b[mem];
  }
  if (mem == 0) {
    a[n - 1] = m + b[n - 1];
    if (b[n - 1] == 0) a[n - 1] *= 2;
    for (int i = n - 2; i > 0; i--) {
      a[i] = a[i + 1] + b[i];
    }
    for (int i = 0; i < n; i++) cout << a[i] << " ";
  } else {
    a[mem - 1] = m + b[mem - 1];
    if (b[mem - 1] == 0) a[mem - 1] *= 2;
    for (int i = mem - 2; i >= 0; i--) {
      a[i] = b[i] + a[i + 1];
    }
    if (mem != n - 1) {
      a[n - 1] = b[n - 1] + a[0];
    }
    for (int i = n - 2; i > mem; i--) {
      a[i] = b[i] + a[i + 1];
    }
    if (mem < n - 1 && a[mem + 1] == m) a[mem + 1] *= 2;
    if (mem == n - 1 && a[0] == m) a[0] *= 2;
    for (int i = 0; i < n; i++) cout << a[i] << " ";
  }
}
