#include <bits/stdc++.h>
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline void sub(long long &a, long long b) {
  a -= b;
  if (a < 0) a += 1000000007;
}
inline void add(long long &a, long long b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
inline long long mul(long long a, long long b, long long c) {
  return (a * b - (long long)((long double)a * b / c) * c + c) % c;
}
inline long long qp(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % 1000000007;
    a = a * a % 1000000007, b >>= 1;
  }
  return ans;
}
inline long long qp(long long a, long long b, long long c) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = mul(ans, a, c);
    a = mul(a, a, c), b >>= 1;
  }
  return ans;
}
using namespace std;
const long double pi = acos(-1);
const unsigned long long ba = 233;
const double eps = 1e-8;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int N = 200000 + 10, maxn = 1000000 + 10, inf = 0x3f3f3f3f;
long long a[N], b[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  long long ma = *max_element(a, a + n);
  if (!ma) {
    puts("YES");
    for (int i = 0; i < n; i++) printf("1 ");
    puts("");
    return 0;
  }
  int pos = -1;
  for (int i = 0; i < n; i++)
    if (a[i] == ma && a[i] > a[(i - 1 + n) % n]) {
      pos = i;
      break;
    }
  if (pos == -1) return 0 * puts("NO");
  b[pos] = a[pos];
  for (int i = pos, j = 1; j < n; j++, i = (i - 1 + n) % n) {
    b[(i - 1 + n) % n] = b[i] + a[(i - 1 + n) % n];
    if (b[(i - 1 + n) % n] == ma) b[(i - 1 + n) % n] += ma;
  }
  puts("YES");
  for (int i = 0; i < n; i++) printf("%lld ", b[i]);
  puts("");
  return 0;
}
