#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n + 1), b(n + 1);
  for (int i = 1; i <= n; i++) cin >> b[i];
  int pos = 0;
  b[0] = b[n];
  for (int i = 1; i <= n; i++)
    if (b[i] > b[i - 1]) pos = i;
  if (pos == 0) {
    if (b[0] == 0) {
      cout << "YES\n";
      for (int i = 1; i <= n; i++) cout << "1 ";
    } else
      cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  a[pos] = 1e6 * b[pos];
  for (int i = pos - 1; i >= 1; i--) a[i] = a[i + 1] + b[i];
  for (int i = n; i >= pos + 1; i--)
    if (i == n)
      a[n] = a[1] + b[n];
    else
      a[i] = a[i + 1] + b[i];
  a[pos] /= 1e6;
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
}
