#include <bits/stdc++.h>
using namespace std;
ifstream in;
ofstream out;
const long long kk = 1000;
const long long ml = kk * kk;
const long long mod = ml * kk + 7;
const long long inf = ml * ml * ml + 7;
long long n, i, j;
vector<long long> m;
bool viv = false;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    long long a;
    cin >> a;
    m.push_back(a);
  }
  long long p = -1;
  for (i = 0; i < n; i++)
    if (m[i] != 0) p = i;
  if (p == -1) {
    cout << "YES" << endl;
    for (auto i : m) cout << 239 << ' ';
    return 0;
  }
  long long pm = 0;
  for (i = 0; i < n; i++)
    if (m[i] > m[pm]) pm = i;
  long long kol = 0;
  for (i = 0; i < n; i++)
    if (m[i] != m[pm] && m[i] != 0) kol++;
  if (kol == 0) {
    long long lkol = 0;
    for (i = 0; i < n; i++)
      if (m[i] == 0) lkol++;
    if (lkol == 0) {
      cout << "NO" << endl;
      return 0;
    }
    vector<long long> ans;
    for (i = 0; i < n; i++)
      if (m[(i + n - 1) % n] == 0)
        ans.push_back(m[pm]);
      else
        ans.push_back(-1);
    for (i = n - 1; i >= 0; i--)
      if (ans[(i + 1 + n) % n] != -1 && ans[i] == -1)
        ans[i] = ans[(i + 1 + n) % n] + m[pm];
    for (i = n - 1; i >= 0; i--)
      if (ans[(i + 1 + n) % n] != -1 && ans[i] == -1)
        ans[i] = ans[(i + 1 + n) % n] + m[pm];
    cout << "YES" << endl;
    for (auto i : ans) cout << i << ' ';
    return 0;
  }
  long long z = 0;
  for (i = 0; i < n; i++)
    if (m[i] != 0 && m[i] != m[pm]) z = i;
  p = z;
  while (m[p] != m[pm]) p = (p + 1) % n;
  vector<long long> ans;
  for (i = 0; i < n; i++) ans.push_back(m[(i + p + 1) % n]);
  for (i = n - 2; i >= 0; i--) ans[i] = ans[i + 1] + ans[i];
  vector<long long> dans;
  for (i = 0; i < n; i++) dans.push_back(ans[(i - p - 1 + n) % n]);
  for (i = 0; i < n; i++) ans[i] = dans[i];
  cout << "YES" << endl;
  for (auto i : ans) cout << i << ' ';
  cout << endl;
  return 0;
}
