#include <bits/stdc++.h>
using namespace std;
template <class C>
void mini(C &a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C &a4, C b4) {
  a4 = max(a4, b4);
}
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << '=' << h << endl;
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << '=' << h << ',';
  _dbg(sdbg + 1, a...);
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V) {
  os << "[";
  for (auto vv : V) os << vv << ",";
  return os << "]";
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
const long long MAX = 200010;
long long n, t[MAX], res[MAX];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  if (0) cout << fixed << setprecision(6);
  cin >> n;
  long long ma = -1;
  for (long long i = (0); i <= ((long long)(n)-1); i++) {
    cin >> t[i];
    maxi(ma, t[i]);
  }
  if (ma == 0) {
    cout << "YES\n";
    for (long long i = (0); i <= ((long long)(n)-1); i++) {
      cout << "1 ";
    }
    cout << "\n";
    return 0;
  }
  t[n] = t[0];
  for (long long i = (0); i <= ((long long)(n)-1); i++) {
    if (t[i] != ma && t[i + 1] == ma) {
      long long sum = 2 * ma;
      i++;
      if (i == n) i = 0;
      res[i] = ma;
      for (long long _ = (0); _ <= ((long long)(n - 1) - 1); _++) {
        i--;
        if (i == -1) i = n - 1;
        sum += t[i];
        res[i] = sum;
      }
      cout << "YES\n";
      for (long long j = (0); j <= ((long long)(n)-1); j++) {
        cout << res[j] << " ";
      }
      cout << "\n";
      return 0;
    }
  }
  cout << "NO\n";
}
