#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> bs(n);
  for (auto &x : bs) cin >> x;
  if (count(bs.begin(), bs.end(), 0) == n) {
    cout << "YES" << endl;
    for (int _ = 0; _ < (n); ++_) cout << 1 << ' ';
    cout << endl;
    return 0;
  }
  auto prv = [&](int i) { return (i + n - 1) % n; };
  bs.push_back(bs[0]);
  for (int i = 0; i < (n); ++i)
    if (bs[i] > bs[prv(i)]) {
      vector<long long> a(n);
      a[i] = bs[i];
      for (int k = prv(i); k != i; k = prv(k)) {
        int j = prv(k), l = (k + 1) % n;
        long long x;
        long long dif = bs[j] - bs[k];
        if (dif < 0)
          x = 0;
        else {
          x = 1 + dif / a[l];
        }
        a[k] = bs[k] + x * a[l];
      }
      cout << "YES" << endl;
      for (auto &x : a) cout << x << ' ';
      cout << endl;
      return 0;
    }
  cout << "NO" << endl;
}
