#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("-O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long MaxN = 4e3 + 100;
const long long LogN = 20;
long long Inf = 1e9 + 100;
const long long dx[4] = {0, 1, 0, -1};
const long long dy[4] = {1, 0, -1, 0};
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long N;
  cin >> N;
  vector<long long> Bt(N);
  vector<long long> Ct(N);
  long long Mx = -Inf;
  long long id = -1;
  long long cnt = 0;
  bool f = 0;
  for (int i = 0; i < N; i++) {
    cin >> Bt[i];
    if (Mx < Bt[i]) {
      Mx = Bt[i];
      cnt = 0;
      f = 0;
    }
    if (Mx == Bt[i]) {
      if (Bt[(i - 1 + N) % N] < Mx) id = i;
      cnt++;
    }
  }
  if (cnt == N && Mx != 0) {
    cout << "NO";
    return 0;
  }
  if (Mx == 0) {
    cout << "YES" << '\n';
    for (int i = 0; i < N; i++) cout << 1 << ' ';
    return 0;
  }
  id = N - 1 - id;
  for (int i = 0; i < N; i++) {
    Ct[i] = Bt[(i - id + N) % N];
  }
  Bt = Ct;
  vector<long long> At(N);
  At[N - 1] = Bt[N - 1];
  At[N - 2] = Bt[N - 1] * 2 + Bt[N - 2];
  for (int i = N - 3; i >= 0; i--) {
    At[i] = At[i + 1] + Bt[i];
  }
  cout << "YES" << '\n';
  for (int i = 0; i < N; i++) {
    Ct[i] = At[(i + id) % N];
  }
  for (int i = 0; i < N; i++) {
    cout << Ct[i] << ' ';
  }
  return 0;
}
