#include <bits/stdc++.h>
using namespace std;
const int maxn = 150000 << 1;
int n, b[maxn], st, ed = 0;
long long a[maxn];
void allsame() {
  for (int i = 2; i <= n; ++i)
    if (b[i] != b[i - 1]) return;
  if (b[1] != 0)
    puts("NO");
  else {
    puts("YES");
    for (int i = 1; i <= n; ++i) printf("%d%c", 1, (i == n ? '\n' : ' '));
  }
  exit(0);
}
int pre(int x) {
  if (x == 1) return n;
  return x - 1;
}
void find_st_ed() {
  allsame();
  for (int i = 1; i <= n; ++i) {
    b[i + n] = b[i];
    if (b[i] > b[ed]) ed = i;
  }
  while (b[ed] == b[pre(ed)]) ed = pre(ed);
  st = ed + 1;
  ed += n;
}
void solve() {
  a[ed] = 0;
  for (int i = ed - 1; i >= st; --i) a[i] = a[i + 1] + b[i];
  a[ed] = b[ed];
  for (int i = ed - 1; i >= st; --i) a[i] += b[ed] << 1;
  for (int i = 1; i < st; ++i) a[i] = a[i + n];
  puts("YES");
  for (int i = 1; i <= n; ++i) printf("%lld%c", a[i], (i == n ? '\n' : ' '));
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &b[i]);
  find_st_ed();
  solve();
  return 0;
}
