#include <bits/stdc++.h>
using namespace std;
int n;
long long arr[200010], res[200010];
bool same() {
  for (int i = 2; i <= n; ++i)
    if (arr[i] != arr[i - 1]) return false;
  return true;
}
void work() {
  bool firstzero = true;
  long long Max = 0, pos = -1;
  for (int i = 1; i <= n; ++i) Max = max(Max, arr[i]);
  for (int i = 1; i <= n; ++i)
    if (arr[i] == Max && arr[(i - 2 + n) % n + 1] != Max) {
      pos = i;
      break;
    }
  res[pos] = arr[pos];
  for (int i = pos - 1, cnt = 0; cnt < n - 1; --i, ++cnt) {
    int x = (i - 1 + n) % n + 1;
    int pre = (x + n) % n + 1;
    if (arr[x] == 0 && firstzero) {
      firstzero = false;
      res[x] = res[pre] << 1;
    } else
      res[x] = arr[x] + res[pre];
  }
  return;
}
void Run() {
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i <= n; ++i) scanf("%lld", arr + i);
    if (same()) {
      if (arr[1] == 0) {
        puts("YES");
        for (int i = 1; i <= n; ++i) printf("1%c", " \n"[i == n]);
      } else
        puts("NO");
    } else {
      work();
      puts("YES");
      for (int i = 1; i <= n; ++i) printf("%lld%c", res[i], " \n"[i == n]);
    }
  }
}
int main() {
  Run();
  return 0;
}
