#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
const int N = 201000;
int n, a[N];
long long b[N];
void gao(long long &a, long long b, long long c) {
  if (a == 0) a = b;
  if (a > c) return;
  a += (c - a + b) / b * b;
  assert(a > c && a - b <= c);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  if (*max_element(a, a + n) == 0) {
    puts("YES");
    for (int i = 0; i < n; i++) printf("%d%c", 1, " \n"[i == n - 1]);
    return 0;
  }
  for (int i = 0; i < n; i++)
    if (a[i] < a[(i + 1) % n]) {
      b[(i + 1) % n] = a[(i + 1) % n];
      for (int j = 0; j < n - 1; j++) {
        int cur = (i - j + n) % n;
        b[cur] = a[cur];
        gao(b[cur], b[(cur + 1) % n], a[(cur + n - 1) % n]);
      }
      puts("YES");
      for (int i = 0; i < n; i++) printf("%lld%c", b[i], " \n"[i == n - 1]);
      return 0;
    }
  puts("NO");
}
