#include <bits/stdc++.h>
const long long N = 200005;
long long n, a[N], b[N], pos = -1, m;
long long co(long long x) { return (!x) ? n : x; }
signed main() {
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) scanf("%lld", &a[i]), b[i] = a[i];
  a[0] = b[0] = b[n];
  for (long long i = 1; i <= n; i++) m = std::max(m, b[i]);
  for (long long i = 1; i <= n; i++)
    if (b[i] == m && b[i - 1] != m) {
      pos = i;
      break;
    }
  if (pos == -1) {
    if (!m) {
      puts("YES");
      for (long long i = 1; i <= n; i++) printf("%lld ", 1ll);
      puts("");
    } else
      puts("NO");
    return 0;
  }
  a[co((pos - 1 + n) % n)] += m;
  for (long long i = 1; i <= n - 1; i++)
    a[co((pos - i + n) % n)] += a[co((pos - i + 1 + n) % n)];
  puts("YES");
  for (long long i = 1; i <= n; i++) printf("%lld ", a[i]);
  return 0;
}
