#include <bits/stdc++.h>
using namespace std;
long long int b[200010];
long long int amid[200010];
int main() {
  int n;
  cin >> n;
  long long int mx, mn;
  cin >> b[0];
  mx = b[0], mn = b[0];
  for (int i = 1; i < n; i++) {
    scanf("%lld", &b[i]);
    mx = max(mx, b[i]);
    mn = min(mn, b[i]);
  }
  if (mx == 0) {
    cout << "YES" << '\n';
    for (int i = 0; i < n; i++) cout << 1 << " ";
    cout << '\n';
    return 0;
  }
  if (mx == mn) {
    cout << "NO" << '\n';
    return 0;
  }
  int ss = 0;
  for (int i = 0; i < n; i++) {
    int pre = i - 1;
    if (i == 0) pre = n - 1;
    if (b[i] == mx && b[pre] != mx) {
      ss = i;
      break;
    }
  }
  amid[ss] = b[ss];
  int pre = ss - 1;
  if (ss == 0) pre = n - 1;
  int tmp = ss;
  while (pre != tmp) {
    amid[pre] = amid[ss] + b[pre];
    if (tmp == ss) amid[pre] += amid[ss];
    ss = pre;
    pre = ss - 1;
    if (ss == 0) pre = n - 1;
  }
  cout << "YES" << '\n';
  for (int i = 0; i < n; i++) cout << amid[i] << " ";
}
