#include <bits/stdc++.h>
using namespace std;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const int maxn = 3e5 + 5;
long long b[maxn];
long long ans[maxn];
long long n;
int main() {
  long long maxx;
  long long minn;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &b[i]);
    if (i == 0) {
      maxx = b[i];
      minn = b[i];
    } else {
      maxx = max(maxx, b[i]);
      minn = min(minn, b[i]);
    }
  }
  if (maxx == minn) {
    if (maxx == 0) {
      printf("YES\n");
      for (int i = 0; i < n; i++) {
        printf("2333 ");
      }
      printf("\n");
    } else {
      printf("NO\n");
    }
    return 0;
  }
  long long pos = 0;
  for (int i = 0; i < n; i++) {
    int tmp = (i - 1 + n) % n;
    if (maxx != b[tmp] && b[i] == maxx) pos = i;
  }
  ans[pos] = b[pos];
  for (int i = (pos - 1 + n) % n; i != pos; i = ((i - 1 + n) % n)) {
    if (i == (pos - 1 + n) % n)
      ans[i] = b[i] + 2 * (ans[(i + 1) % n]);
    else
      ans[i] = b[i] + ans[(i + 1) % n];
  }
  printf("YES\n");
  for (int i = 0; i < n; i++) {
    printf("%lld ", ans[i]);
  }
  return 0;
}
