#include <bits/stdc++.h>
using namespace std;
const int MAXN = 140582 + 100;
int n, x, mn;
bool flag = 0, vis[MAXN];
long long sum, a[MAXN], b[MAXN];
void work(int x) {
  vis[x] = 1;
  int p = x == 1 ? n : x - 1;
  a[p] = b[p];
  while (a[p] < mn) a[p] += a[x];
  if (n > 2) {
    int pp = p == 1 ? n : p - 1;
    while (a[p] <= b[pp]) a[p] += a[x];
  }
  if (!vis[p]) work(p);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &b[i]), sum += b[i];
  if (sum == 0) {
    puts("YES");
    for (int i = 1; i <= n; ++i) printf("1 ");
    return 0;
  }
  if (b[1] > b[n]) {
    flag = 1;
    x = 1;
  } else {
    for (int i = 2; i <= n; ++i)
      if (b[i] > b[i - 1]) {
        x = i;
        flag = 1;
        break;
      }
  }
  if (!flag) {
    puts("NO");
    return 0;
  } else
    puts("YES");
  mn = a[x] = b[x];
  work(x);
  for (int i = 1; i <= n; ++i) printf("%lld ", a[i]);
  return 0;
}
