#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000007 + 1;
const int N = 200000;
long long a[200006], b[200006];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long mx = 0;
  int cnt2 = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
    if (a[i] == 0) cnt2++;
  }
  int cnt = 0;
  for (int i = 0; i < n; i++)
    if (mx == a[i]) cnt++;
  if (cnt == n) {
    if (cnt2 == n) {
      cout << "YES" << '\n';
      for (int i = 1; i <= n; i++) cout << 1 << " ";
      cout << '\n';
      return 0;
    }
    cout << "NO" << '\n';
    return 0;
  }
  int j = -1;
  for (int i = 1; i < n; i++)
    if (a[i - 1] < a[i] && a[i] == mx) {
      j = i;
      break;
    }
  if (j == -1) j = 0;
  cout << "YES" << '\n';
  b[j] = a[j];
  int f = (j - 1 + n) % n;
  b[f] = 2LL * b[j] + a[f];
  int u = j;
  j = (j - 2 + n) % n;
  while (j != u) {
    b[j] = a[j] + b[(j + 1) % n];
    j = (j - 1 + n) % n;
  }
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << '\n';
  return 0;
}
