#include <bits/stdc++.h>
using namespace std;
int N, B[555555];
long long A[555555];
int main(int argc, char *argv[]) {
  scanf("%d", &N);
  for (int i = 0; i < (N); i++) scanf("%d", B + i);
  int start = -1;
  for (int i = 0; i < (N); i++)
    if (B[(i + 1) % N] > B[i]) {
      start = (i + 1) % N;
      break;
    }
  if (start == -1) {
    for (int i = 0; i < (N); i++)
      if (B[i]) {
        printf("NO\n");
        return 0;
      }
    printf("YES\n");
    for (int i = 0; i < (N); i++) {
      if (i) printf(" ");
      printf("1");
    }
    printf("\n");
    return 0;
  }
  A[start] = B[start];
  for (int i = 0; i < (N - 1); i++) {
    int x = (start + N - i) % N;
    int y = (x + N - 1) % N;
    int z = (y + N - 1) % N;
    A[y] = B[y] + A[x] * ((B[z] - B[y]) / A[x] + 1);
  }
  printf("YES\n");
  for (int i = 0; i < (N); i++) {
    if (i) printf(" ");
    cout << A[i];
  }
  printf("\n");
  return 0;
}
