Problem: While discussing a proper problem A for a Codeforces Round, Kostya created a cyclic array of positive integers a_1, a_2, …, a_n. Since the talk was long and not promising, Kostya created a new cyclic array b_1, b_2, …, b_{n} so that b_i = (a_i mod a_{i + 1}), where we take a_{n+1} = a_1. Here mod is the [modulo operation](https://en.wikipedia.org/wiki/Modulo_operation). When the talk became interesting, Kostya completely forgot how array a had looked like. Suddenly, he thought that restoring array a from array b would be an interesting problem (unfortunately, not A).

Input

The first line contains a single integer n (2 ≤ n ≤ 140582) — the length of the array a.

The second line contains n integers b_1, b_2, …, b_{n} (0 ≤ b_i ≤ 187126).

Output

If it is possible to restore some array a of length n so that b_i = a_i mod a_{(i mod n) + 1} holds for all i = 1, 2, …, n, print «YES» in the first line and the integers a_1, a_2, …, a_n in the second line. All a_i should satisfy 1 ≤ a_i ≤ 10^{18}. We can show that if an answer exists, then an answer with such constraint exists as well.

It it impossible to restore any valid a, print «NO» in one line.

You can print each letter in any case (upper or lower).

Examples

Input

4
1 3 1 0


Output

YES
1 3 5 2


Input

2
4 4


Output

NO

Note

In the first example:

  * 1 mod 3 = 1 
  * 3 mod 5 = 3 
  * 5 mod 2 = 1 
  * 2 mod 1 = 0 

Solution (in JAVA):

Solution:
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Stack;

public class Main {

    PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    private static boolean debug = false;

    private String nextString() {
        StringBuilder sb = new StringBuilder();
        try {
            char c = (char) System.in.read();
            while (c == ' ' || c == '\n' || c == '\t') {
                c = (char) System.in.read();
            }
            do {
                sb.append(c);
                c = (char) System.in.read();
            } while (c != ' ' && c != '\n' && c != '\t');
        } catch (IOException e) {
            e.printStackTrace();
        }
        return sb.toString();
    }

    private int nextInt() {
        int r = 0;
        boolean f = false;
        try {
            int c = System.in.read();
            while (c < '0' || c > '9') {
                if (c == '-') {
                    f = true;
                }
                c = System.in.read();
            }
            while (c >= '0' && c <= '9') {
                r = r * 10 + c - '0';
                c = System.in.read();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (f) {
            r *= -1;
        }
        return r;
    }

    private long nextLong() {
        long r = 0;
        boolean f = false;
        try {
            int c = System.in.read();
            while (c < '0' || c > '9') {
                if (c == '-') {
                    f = true;
                }
                c = System.in.read();
            }
            while (c >= '0' && c <= '9') {
                r = r * 10 + c - '0';
                c = System.in.read();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (f) {
            r *= -1;
        }
        return r;
    }

    private void println(String s) {
        out.write(s);
        out.write('\n');
        out.flush();
    }

    private void print(String s) {
        out.write(s);
        out.flush();
    }

    private void println(long s) {
        println(String.valueOf(s));
    }

    public class AVL<T> {

        private Node<T> root = null;
        private final Comparator<T> comparator;

        public AVL(Comparator<T> comparator) {
            this.comparator = comparator;
        }

        public void insert(T v) {
            if (root == null) {
                root = new Node<>(v, this.comparator);
            } else {
                root = root.insert(v);
            }
        }

        public int gt(T v) {
            return root == null ? 0 : root.gt(v);
        }

        public class Node<T> {
            T v;
            Comparator<T> comparator;
            int size = 1;
            int dep = 1;
            Node<T> lc = null;
            Node<T> rc = null;

            public Node(T v, Comparator<T> comparator) {
                this.v = v;
                this.comparator = comparator;
            }

            private int getDep(Node node) {
                return node == null ? 0 : node.dep;
            }

            private int getSize(Node node) {
                return node == null ? 0 : node.size;
            }

            public Node<T> insert(T v) {
                Node<T> rt = this;
                if (comparator.compare(v, this.v) >= 0) {
                    if (this.rc == null) {
                        this.rc = new Node<>(v, this.comparator);
                    } else {
                        this.rc = this.rc.insert(v);
                    }
                } else {
                    if (this.lc == null) {
                        this.lc = new Node<>(v, this.comparator);
                    } else {
                        this.lc = this.lc.insert(v);
                    }
                }
                if (getDep(this.lc) > getDep(this.rc) + 1) {
                    Node<T> lc = this.lc;
                    this.lc = lc.rc;
                    lc.rc = this;
                    this.update();
                    lc.update();
                    rt = lc;
                } else if (getDep(this.rc) > getDep(this.lc) + 1) {
                    Node<T> rc = this.rc;
                    this.rc = rc.lc;
                    rc.lc = this;
                    this.update();
                    rc.update();
                    rt = rc;
                } else {
                    this.update();
                }
                return rt;
            }

            private void update() {
                this.dep = Math.max(getDep(this.rc), getDep(this.lc)) + 1;
                this.size = getSize(this.rc) + getSize(this.lc) + 1;
            }

            public int gt(T v) {
                if (comparator.compare(v, this.v) >= 0) {
                    return this.rc == null ? 0 : this.rc.gt(v);
                } else {
                    return getSize(this.rc) + 1 + (this.lc == null ? 0 : this.lc.gt(v));
                }
            }
        }

    }

    public static void main(String[] args) {
        new Main().resolve();
    }

    private void resolve() {
        int n = nextInt();
        long[] x = new long[n];
        boolean dif = false;
        int ind = 0;
        for (int i = 0; i <n; i++) {
            x[i] = nextLong();
            if (i > 0 && x[i] != x[0]) {
                dif = true;
            }
            if (x[i] > x[ind]) {
                ind = i;
            }
        }
        if (!dif) {
            if (x[0] == 0) {
                println("YES");
                for (int i = 0; i < n; i++) {
                    print(1 + (i == n - 1 ? "\n" : " "));
                }
            } else {
                println("NO");
            }
        } else {
            boolean mul = true;
            while (x[ind] == x[(ind - 1 + n) % n]) {
                ind = (ind - 1 + n) % n;
            }
            for (int i = 1; i < n; i++) {
                if (x[(ind - i + n) % n] == 0 && mul) {
                    mul = false;
                    x[(ind - i + n) % n] = 2 * x[(ind - i + n + 1) % n];
                } else {
                    x[(ind - i + n) % n] = x[(ind - i + n) % n] + x[(ind - i + n + 1) % n];
                }
            }
            println("YES");
            for (int i = 0; i < n; i++) {
                print(x[i] + (i == n - 1 ? "\n" : " "));
            }
        }
    }
}