#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300010;
int n, b[MAXN], c[MAXN];
long long a[MAXN];
int main() {
  scanf("%d", &n);
  int maxb = 0;
  for (int i = 0; i < n; ++i) scanf("%d", b + i), maxb = max(maxb, b[i]);
  if (maxb == 0) {
    puts("YES");
    for (int i = 0; i < n; ++i) printf("%d%c", 1, " \n"[i == n - 1]);
    return 0;
  }
  bool can = false;
  for (int i = 0; i < n; ++i)
    if (b[i] != maxb) can = true;
  if (!can) {
    puts("NO");
    return 0;
  }
  int id = -1;
  for (int i = 0; i < n; ++i)
    if (b[i] == maxb && b[i] > b[(i - 1 + n) % n]) {
      id = i;
      break;
    }
  for (int i = 0; i < n; ++i) c[i] = b[(i + id + 1) % n];
  long long cur = 0;
  puts("YES");
  for (int i = n - 1; i >= 0; --i) {
    if (i == n - 1)
      a[(i + id + 1) % n] = c[i];
    else
      cur += c[i], a[(i + id + 1) % n] = 2LL * c[n - 1] + cur;
  }
  for (int i = 0; i < n; ++i) printf("%I64d%c", a[i], " \n"[i == n - 1]);
}
