#include <bits/stdc++.h>
using namespace std;
long long a[200000], ans[200000], p, mini, maxi;
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", a + i);
    if (i == 1)
      mini = maxi = a[i];
    else
      mini = min(mini, a[i]), maxi = max(maxi, a[i]);
  }
  if (maxi == mini) {
    if (!maxi) {
      puts("YES");
      for (int i = 1; i <= n; i++) printf("1 ");
    } else
      puts("NO");
    return 0;
  }
  for (int i = 1; i <= n; i++)
    if (maxi == a[i % n + 1] && a[i] != maxi) p = i % n + 1;
  ans[p] = a[p];
  for (int i = (p == 1 ? n : p - 1); i != p; i = (i == 1 ? n : i - 1))
    if (i == (p == 1 ? n : p - 1))
      ans[i] = a[i] + ans[i % n + 1] * 2;
    else
      ans[i] = a[i] + ans[i % n + 1];
  puts("YES");
  for (int i = 1; i <= n; i++) printf("%I64d ", ans[i]);
}
