#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 1;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f *= -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - '0';
    s = getchar();
  }
  return x * f;
}
int n = read(), b[140587];
long long a[140587];
int main() {
  bool ok = 1;
  for (int i = 1; i <= n; i++) b[i] = read();
  int k = 0;
  b[0] = b[n];
  for (int i = 1; i <= n; i++) {
    if (b[i] > b[i - 1]) {
      k = i;
      ok = 0;
      break;
    }
  }
  if (ok) {
    if (b[1] == 0) {
      puts("YES");
      for (int i = 1; i < n; i++) putchar('1'), putchar(' ');
      puts("1");
      return 0;
    } else {
      puts("NO");
      return 0;
    }
  } else {
    a[k] = 1ll * b[k];
    for (int i = k - 1;; i--) {
      int j = i + 1;
      if (i == 0) i = n;
      int l = i - 1;
      if (l == 0) l = n;
      if (i == k) break;
      a[i] = 1ll * b[i];
      a[i] += ((1ll * (b[l] - b[i]) + a[j]) / a[j]) * a[j];
    }
    puts("YES");
    for (int i = 1; i < n; i++) printf("%lld ", a[i]);
    printf("%lld\n", a[n]);
  }
  return 0;
}
