#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (auto &it : a) cin >> it;
  long long int mx = *max_element(a.begin(), a.end());
  long long int pos = -1;
  for (long long int i = 0; i < n; i++) {
    if (a[i] == mx && a[(i - 1 + n) % n] != mx) {
      pos = i;
      break;
    }
  }
  if (pos == -1) {
    if (!mx) {
      cout << "YES\n";
      for (long long int i = 0; i < n; i++) cout << "1 ";
    } else
      cout << "NO";
    return 0;
  }
  vector<long long int> b;
  b = a;
  b[pos] = a[pos];
  long long int poss = 1;
  long long int curr = a[pos] * (1ll << 25);
  for (long long int j = 1; j < n; j++) {
    long long int idx = (pos - j + n) % n;
    b[idx] += curr;
    curr = b[idx];
    if (b[idx] % b[(idx + 1) % n] != a[idx]) poss = 0;
  }
  if (b[pos] % b[(pos + 1) % n] != a[pos]) poss = 0;
  if (poss) {
    cout << "YES\n";
    for (auto &it : b) cout << it << " ";
  } else
    cout << "NO";
  return 0;
}
