#include <bits/stdc++.h>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
bool Finish_read;
template <class T>
inline void read(T &x) {
  Finish_read = 0;
  x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    if (ch == EOF) return;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  x *= f;
  Finish_read = 1;
}
template <class T>
inline void print(T x) {
  if (x / 10 != 0) print(x / 10);
  putchar(x % 10 + '0');
}
template <class T>
inline void writeln(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
  putchar('\n');
}
template <class T>
inline void write(T x) {
  if (x < 0) putchar('-');
  x = abs(x);
  print(x);
}
const int maxn = 400005;
long long a[maxn], ans[maxn], n, idx, mn = 1e9, mx = 0;
inline void getans() {
  puts("YES");
  for (int i = 0; i < n; i++)
    printf("%lld", ans[i]), putchar(i == n - 1 ? '\n' : ' ');
}
inline int pre(int x) { return !x ? n - 1 : x - 1; }
inline int suf(int x) { return x == n - 1 ? 0 : x + 1; }
inline void init() {
  read(n);
  for (int i = 0; i < n; i++)
    read(a[i]), mx = max(mx, a[i]), mn = min(mn, a[i]);
}
inline void restore() {
  for (int i = 0; i < n; i++)
    if (mx != a[pre(i)] && mx == a[i]) idx = i;
  ans[idx] = a[idx];
  for (int i = pre(idx); i != idx; i = pre(i))
    ans[i] = a[i] + ans[suf(i)] * ((i == pre(idx)) + 1);
}
int main() {
  init();
  if (mx == mn) {
    if (!mx) {
      puts("YES");
      for (int i = 0; i < n; i++) printf("1 ");
      printf("\n");
    } else
      puts("NO");
    return 0;
  }
  restore();
  getans();
}
