#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void gn(T &x) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), x = 0; c >= '0' && c <= '9';
       c = getchar())
    x = (x << 1) + (x << 3) + c - '0';
  if (sg) x = -x;
}
template <class T1, class T2>
inline void gn(T1 &x1, T2 &x2) {
  gn(x1), gn(x2);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
long long b[200010];
long long a[200010];
int n;
const int min_value = 200000;
inline int nxt(int x) {
  x++;
  if (x == n + 1) x = 1;
  return x;
}
inline int pre(int x) {
  x--;
  if (!x) x = n;
  return x;
}
int main() {
  gn(n);
  for (int i = 1; i <= n; i++) gn(b[i]);
  int id = -1;
  for (int i = 1; i <= n; i++)
    if (b[i] > b[pre(i)]) {
      id = i;
      break;
    }
  if (id == -1) {
    if (b[1] == 0) {
      puts("YES");
      for (int i = 1; i <= n; i++) printf("%d ", 1);
      return 0;
    }
    return puts("NO"), 0;
  }
  a[id] = b[id];
  puts("YES");
  for (int ii = 1; ii < n; ii++) {
    a[pre(id)] = b[pre(id)];
    while (a[pre(id)] <= min_value) a[pre(id)] += a[id];
    id = pre(id);
  }
  for (int i = 1; i <= n; i++) printf("%I64d ", a[i]);
}
