#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
int n;
long long b[maxn], a[maxn];
int i, j;
long long gett(long long x, long long y) {
  int t = x % y;
  if (t < 0) t += y;
  return (x - t) / y;
}
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) cin >> b[i];
  b[0] = b[n];
  for (i = 1; i <= n; i++)
    if (b[i] > b[i - 1]) break;
  if (i > n) {
    if (b[0])
      puts("NO");
    else {
      puts("YES");
      for (int i = 1; i <= n; i++) cout << "1 ";
    }
    return 0;
  }
  puts("YES");
  a[i] = b[i];
  for (j = (i + n - 2) % n + 1; j != i; j = (j + n - 2) % n + 1) {
    a[j] =
        max(0LL, gett(b[j - 1] - b[j], a[j % n + 1]) + 1) * a[j % n + 1] + b[j];
  }
  for (int i = 1; i <= n; i++) cout << a[i] << " ";
  return 0;
}
