#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int n, pos;
long long a[N], b[N], max1;
bool allsame() {
  for (int i = 1; i < n; i++)
    if (b[i] != b[0]) return 0;
  return 1;
}
int main() {
  scanf("%d", &n);
  max1 = -1e9;
  for (int i = 0; i < n; i++) scanf("%lld", &b[i]), max1 = max(max1, b[i]);
  if (allsame()) {
    if (max1)
      puts("NO");
    else {
      puts("YES");
      for (int i = 1; i <= n; i++) printf("19260817 ");
    }
    return 0;
  }
  for (int i = 0; i < n; i++)
    if (b[i] == max1 && b[(i + n - 1) % n] != max1) pos = i;
  a[pos] = b[pos];
  int now = (pos + n - 1) % n;
  while (now != pos) {
    if (now == (pos + n - 1) % n)
      a[now] = b[now] + a[(now + 1) % n] * 2;
    else
      a[now] = b[now] + a[(now + 1) % n];
    now = (now + n - 1) % n;
  }
  puts("YES");
  for (int i = 0; i < n; i++) printf("%lld ", a[i]);
}
