#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
long long B[200000];
long long A[200000];
int main() {
  ios_base::sync_with_stdio(0);
  int N;
  cin >> N;
  for (int i = 0; i < (N); ++i) cin >> B[i];
  B[N] = B[0];
  bool equal = true;
  for (int i = 0; i < (N); ++i) equal = equal && (B[i] == B[i + 1]);
  if (equal) {
    if (B[0] == 0) {
      cout << "YES" << endl;
      for (int i = 0; i < (N); ++i) cout << "1 ";
      cout << endl;
    } else {
      cout << "NO" << endl;
    }
    return 0;
  }
  for (int k = 0; k < (N); ++k)
    if (B[k] > B[(k + N - 1) % N]) {
      A[k] = B[k];
      for (int q = 0; q < (N - 1); ++q) {
        int i = (k - 1 - q + N) % N;
        long long prev = B[(i + N - 1) % N];
        long long nxt = A[(i + 1) % N];
        A[i] = B[i];
        if (A[i] <= prev) {
          long long needed = (prev - A[i]) / nxt;
          A[i] += (needed + 1) * nxt;
        }
      }
      cout << "YES" << endl;
      for (int i = 0; i < (N); ++i) cout << A[i] << " ";
      cout << endl;
      return 0;
    }
}
