#include <bits/stdc++.h>
using namespace std;
int n;
int a[200002];
long long b[2000002];
long long ts = 1000000000000;
int main() {
  cin >> n;
  bool pqr = false;
  int j = -1;
  int chzr = -1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    chzr = max(chzr, a[i]);
    if (i != 0 && a[i] > a[i - 1]) j = i;
  }
  if (chzr == 0) {
    cout << "YES" << endl;
    for (int i = 0; i < n; i++) cout << 1 << " ";
    cout << endl;
    return 0;
  }
  if (a[0] > a[n - 1]) j = 0;
  if (j != -1) {
    b[j] = a[j];
    int nxi = (j - 1 + n) % n;
    long long nx = (ts / a[j]) * a[j];
    for (int i = j - 1; i >= 0; i--) {
      nx += a[i];
      b[i] = nx;
    }
    for (int i = n - 1; i > j; i--) {
      nx += a[i];
      b[i] = nx;
    }
  }
  for (int i = 0; i < n; i++) {
    if (b[(i + 1) % n] == 0 || b[i] % b[(i + 1) % n] != a[i]) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << endl;
  return 0;
}
