#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200200, INF = 0x3f3f3f3f;
int n, b[MAXN], idx, cur;
long long a[MAXN], mx = -INF;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &b[i]);
    if (b[i] > mx) mx = b[i], idx = i;
  }
  if (mx == 0) {
    printf("YES\n");
    for (int i = 0; i < n; ++i) printf("1 ");
    exit(0);
  }
  int idx_ = idx;
  while (b[(n + idx_ - 1) % n] == mx && idx_ != idx + 1)
    idx_ = (n + idx_ - 1) % n;
  idx = idx_;
  a[idx] = b[idx];
  a[idx] += (a[idx] == 0);
  cur = (n + idx - 1) % n;
  a[cur] = 2 * a[(cur + 1) % n] + b[cur];
  cur = (n + cur - 1) % n;
  while (cur != idx) {
    a[cur] = a[(cur + 1) % n] + b[cur];
    cur = (n + cur - 1) % n;
  }
  a[n] = a[0];
  for (int i = 0; i < n; ++i)
    if (a[i] % a[i + 1] != b[i]) printf("NO\n"), exit(0);
  printf("YES\n");
  for (int i = 0; i < n; ++i) printf("%lld ", a[i]);
}
