#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> s(n);
  for (int i = 0; i < n; i++) cin >> s[i];
  bool flag = false;
  for (int i = 0; i < n; i++)
    if (s[i] != s[(i + 1) % n]) flag = true;
  if (!flag) {
    if (s[0] == 0) {
      cout << "YES" << endl;
      for (int i = 0; i < n; i++) cout << 1 << " ";
      cout << endl;
      return 0;
    }
    cout << "NO" << endl;
    return 0;
  }
  int x = 0;
  for (int i = 0; i < n; i++)
    if (s[i] > s[x]) x = i;
  while (s[(x + n - 1) % n] == s[x]) x = (x + n - 1) % n;
  vector<long long> answer(n, -1);
  answer[x] = s[x];
  int mini = s[x];
  x = (x + n - 1) % n;
  while (answer[x] == -1) {
    answer[x] = s[x] + answer[(x + 1) % n];
    if (s[x] == 0 && answer[x] == mini) answer[x] *= 2;
    x = (x + n - 1) % n;
  }
  cout << "YES" << endl;
  for (long long i : answer) cout << i << " ";
  cout << endl;
  return 0;
}
