#include <bits/stdc++.h>
using namespace std;
using LLI = long long;
long long NWD(long long blep, long long b) {
  return (b == 0) ? blep : NWD(b, blep % b);
}
long long NWW(long long blep, long long b) { return blep / NWD(blep, b) * b; }
const int MX = 3e5 + 400;
int n, T[MX];
long long ans[MX];
void out() {
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> T[i];
  T[n + 1] = T[1];
  T[0] = T[n];
  for (int i = 1; i <= n; i++) {
    if (T[i] > T[i - 1]) {
      ans[i] = T[i];
      if (i == 1)
        ans[n + 1] = ans[1];
      else if (i == n)
        ans[0] = ans[n];
      for (int j = i - 1; j > i - n; j--) {
        int blep = (j + n) % n;
        if (blep == 0) blep = n;
        ans[blep] = ans[blep + 1] + T[blep];
        while (ans[blep] <= (long long)T[blep - 1]) ans[blep] += ans[blep + 1];
        if (j == 1)
          ans[n + 1] = ans[1];
        else if (j == n)
          ans[0] = ans[n];
      }
      return out(), 0;
    }
  }
  for (int i = 1; i <= n; i++) ans[i] = 1;
  if (T[1] == 0)
    out();
  else
    cout << "NO" << endl;
  getchar();
  getchar();
  return 0;
}
