#include <bits/stdc++.h>
using namespace std;
template <typename T>
void printvec(vector<T>& vec) {
  for (int i = 0; i < vec.size(); i++) {
    cout << vec[i] << " ";
  }
  cout << endl;
}
long long getnum(long long req, long long a, long long b) {
  if (a > req) return a;
  long long x = req - a;
  long long y = x / b;
  y++;
  return y * b + a;
}
int main() {
  std::ios::sync_with_stdio(false);
  int ttt = 1;
  while (ttt--) {
    long long n, i;
    cin >> n;
    vector<long long> b(n);
    for (i = 0; i < n; i++) {
      cin >> b[i];
    }
    vector<long long> a(n);
    for (i = 0; i < n; i++) {
      if (b[i] < b[(i + 1) % n]) break;
    }
    long long idx = i;
    if (idx == n) {
      if (b[0] == 0) {
        cout << "YES" << endl;
        for (i = 0; i < n; i++) {
          cout << 1 << " ";
        }
      } else {
        cout << "NO";
      }
      return 0;
    }
    idx = (idx + n) % n;
    a[(idx + 1) % n] = b[(idx + 1) % n];
    for (i = idx; i != (idx + 1) % n; i = (n + i - 1) % n) {
      a[i] = getnum(b[(i - 1 + n) % n], b[i], a[(i + 1) % n]);
    }
    cout << "YES" << endl;
    printvec(a);
  }
  return 0;
}
