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