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