#include <bits/stdc++.h>
using namespace std;
static int N, mxid = -1, val[200003];
static long long ans[200003];
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%d", &val[i]);
  for (int i = 0; i < N; i++)
    if ((mxid == -1 || val[i] > val[mxid]) && val[i] > val[(i - 1 + N) % N])
      mxid = i;
  for (int i = 0; i < N; i++) {
    if (i && val[i] != val[i - 1]) break;
    if (i == N - 1) {
      if (val[i])
        return puts("NO"), 0;
      else {
        puts("YES");
        for (int i = 0; i < N; i++) printf("1 ");
        puts("");
        return 0;
      }
    }
  }
  ans[mxid] = 2 * val[mxid];
  for (int i = mxid - 1;; i--) {
    if (i < 0) i = N - 1;
    if (i == mxid) break;
    ans[i] = ans[(i + 1) % N] + val[i];
  }
  ans[mxid] = val[mxid];
  puts("YES");
  for (int i = 0; i < N; i++) printf("%lld ", ans[i]);
  puts("");
  return 0;
}
