#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
  int N;
  cin >> N;
  vector<i64> b(N);
  for (int(i) = (0); (i) <= (N - 1); (i)++) {
    cin >> b[i];
  }
  vector<i64> ans(N, 1);
  int cnt = count(b.begin(), b.end(), 0);
  if (cnt == N - 1) {
    i64 B = 0;
    for (int i = 0; i < N; i++) {
      if (b[i]) {
        B = b[i];
        break;
      }
    }
    for (int i = 0; i < N; i++) {
      ans[i] = ((B != b[i]) + 1) * B;
    }
  } else if (cnt < N - 1) {
    int start = 0;
    for (; start < N; start++) {
      if (b[(start - 1 + N) % N] < b[start]) {
        break;
      }
    }
    if (start == N) {
      cout << "NO" << endl;
      return 0;
    }
    ans[start] = b[start];
    for (int i = 0; i < N - 1; i++) {
      i64 r = (start - i + N) % N;
      i64 l = (r - 1 + N) % N;
      i64 rr = (r + 1) % N;
      if (b[l] >= ans[r]) {
        ans[r] += (b[l] - ans[r] + ans[rr] + 1) / ans[rr] * ans[rr];
      }
      ans[l] = ans[r] + b[l];
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < N; i++) {
    cout << ans[i] << " \n"[i == N - 1];
  }
  return 0;
}
