#include <bits/stdc++.h>
using namespace std;
const int N = 15e4 + 5;
int n, b[N];
long long a[N];
int prev(int x) {
  int y = x - 1;
  if (y == 0) y = n;
  return y;
}
int nxt(int x) { return x % n + 1; }
int main() {
  scanf("%d", &n);
  bool f = true;
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  for (int i = 2; i <= n; i++)
    if (b[i] != b[i - 1]) f = false;
  if (f) {
    if (b[1] != 0) return !printf("NO");
    puts("YES");
    for (int i = 1; i <= n; i++) printf("%d ", 3122002);
    return 0;
  }
  int pos;
  for (int i = 1; i <= n; i++) {
    if (b[i] > b[prev(i)]) {
      pos = i;
      break;
    }
  }
  a[pos] = b[pos];
  for (int i = pos - 1; i >= 1; i--) {
    int k = max(1LL, (b[prev(i)] - b[i] + a[nxt(i)]) / a[nxt(i)]);
    a[i] = 1LL * a[nxt(i)] * k + b[i];
  }
  for (int i = n; i > pos; i--) {
    int k = max(1LL, (b[prev(i)] - b[i] + a[nxt(i)]) / a[nxt(i)]);
    a[i] = 1LL * a[nxt(i)] * k + b[i];
  }
  puts("YES");
  for (int i = 1; i <= n; i++) printf("%lld ", a[i]);
  return 0;
}
