#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, P = 1e9 + 7;
int n, a[N];
long long s[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  int mi = 0x3f3f3f3f, ma = -1;
  for (int i = 1; i <= n; ++i) mi = min(mi, a[i]), ma = max(ma, a[i]);
  if (mi == ma) {
    if (mi == 0) {
      puts("YES");
      for (int i = 1; i <= n; ++i) printf("%d%c", 233, " \n"[i == n]);
      return 0;
    }
    puts("NO");
    return 0;
  }
  int fir = -1, tmp;
  for (int i = 1; i <= n; ++i)
    if (a[i] == ma && a[(i == 1 ? n : i - 1)] < ma) {
      fir = i;
      break;
    }
  s[fir] = ma;
  tmp = (fir == 1 ? n : fir - 1);
  s[tmp] = a[tmp] + 2 * s[fir];
  for (int i = (tmp == 1 ? n : tmp - 1); i != fir; i = (i == 1 ? n : i - 1))
    s[i] = a[i] + s[(i == n ? 1 : i + 1)];
  puts("YES");
  for (int i = 1; i <= n; ++i) printf("%lld%c", s[i], " \n"[i == n]);
  return 0;
}
