#include <bits/stdc++.h>
using namespace std;
long long a[200010], b[200010];
int main() {
  int n;
  scanf("%d", &n);
  bool flag = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
    if (i > 0 && b[i] != b[i - 1]) flag = 1;
  }
  if (!flag) {
    if (b[0] == 0) {
      printf("YES\n");
      for (int i = 1; i <= n; i++) printf("1%c", i == n ? '\n' : ' ');
      return 0;
    } else
      return 0 * printf("NO\n");
  }
  for (int i = 0; i < n; i++)
    if (b[i] < b[(i + 1) % n]) {
      a[(i + 1) % n] = b[(i + 1) % n];
      for (int j = 0; j < n - 1; j++) {
        int cur = (i - j + n) % n;
        a[cur] = b[cur];
        if (a[cur] == 0) a[cur] = a[(cur + 1) % n];
        if (a[cur] <= b[(cur - 1 + n) % n])
          a[cur] += ((b[(cur - 1 + n) % n] - a[cur]) / a[(cur + 1) % n] + 1) *
                    a[(cur + 1) % n];
      }
      printf("YES\n");
      for (int j = 0; j < n; j++)
        printf("%lld%c", a[j], j == n - 1 ? '\n' : ' ');
      return 0;
    }
}
