#include <bits/stdc++.h>
using namespace std;
const int maxn = 150000;
long long a[maxn], b[maxn], n, mn = 0x3f3f3f3f, mx = 1, pos;
inline int pre(int x) { return x - 1 + ((x == 1) ? n : 0); }
inline int nxt(int x) { return x + 1 - ((x == n) ? n : 0); }
int main() {
  scanf("%lld", &n);
  bool allzero = 1;
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", a + i);
    if (a[i] >= mx && a[i] != a[pre(i)]) mx = a[i], pos = i;
    if (a[i] < mn) mn = a[i];
    if (a[i] != 0) allzero = 0;
  }
  if (mn == mx || allzero) {
    if (allzero) {
      puts("YES");
      for (int i = 1; i <= n; ++i) printf("1%c", i == n ? '\n' : ' ');
    } else
      puts("NO");
    return 0;
  }
  b[pos] = a[pos];
  int pp = pre(pos);
  b[pp] = a[pp] + b[pos] * 2;
  for (int i = pre(pp); i != pos; i = pre(i)) b[i] = a[i] + b[nxt(i)];
  puts("YES");
  for (int i = 1; i <= n; ++i) printf("%lld%c", b[i], i == n ? '\n' : ' ');
  return 0;
}
