Problem: A group of n friends enjoys playing popular video game Toda 2. There is a rating system describing skill level of each player, initially the rating of the i-th friend is ri.

The friends decided to take part in the championship as a team. But they should have equal ratings to be allowed to compose a single team consisting of all n friends. So the friends are faced with the problem: how to make all their ratings equal.

One way to change ratings is to willingly lose in some matches. Friends can form a party consisting of two to five (but not more than n) friends and play a match in the game. When the party loses, the rating of each of its members decreases by 1. A rating can't become negative, so ri = 0 doesn't change after losing.

The friends can take part in multiple matches, each time making a party from any subset of friends (but remember about constraints on party size: from 2 to 5 members).

The friends want to make their ratings equal but as high as possible.

Help the friends develop a strategy of losing the matches so that all their ratings become equal and the resulting rating is maximum possible.

Input

The first line contains a single integer n (2 ≤ n ≤ 100) — the number of friends.

The second line contains n non-negative integers r1, r2, ..., rn (0 ≤ ri ≤ 100), where ri is the initial rating of the i-th friend.

Output

In the first line, print a single integer R — the final rating of each of the friends.

In the second line, print integer t — the number of matches the friends have to play. Each of the following t lines should contain n characters '0' or '1', where the j-th character of the i-th line is equal to:

  * '0', if friend j should not play in match i, 
  * '1', if friend j should play in match i. 



Each line should contain between two and five characters '1', inclusive.

The value t should not exceed 104, it is guaranteed that such solution exists. 

Remember that you shouldn't minimize the value t, but you should maximize R. If there are multiple solutions, print any of them.

Examples

Input

5
4 5 1 7 4


Output

1
8
01010
00011
01010
10010
00011
11000
00011
11000


Input

2
1 2


Output

0
2
11
11


Input

3
1 1 1


Output

1
0

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Solution {

    public static void solve(InputReader in, PrintWriter out, DebugWriter debug) throws IOException {
        int n = in.nextInt();
        Doter[] a = new Doter[n];
        for (int i=0; i<n; i++) a[i] = new Doter(in.nextInt(), i);
        Arrays.sort(a);

        int sumDelta = 0;
        for (int i=1; i<n; i++) sumDelta += (a[i].rating-a[0].rating);
        debug.println(sumDelta);

        if (sumDelta == 0){
            out.println(a[0].rating);
            out.println(0);
            return;
        }

        print(a, debug);
        Doter[] copy1 = copy(a);
        Doter[] copy2 = copy(a);

        Boolean[] array = null;
        if (sumDelta % 2 == 1 && n > 2){
            array = new Boolean[n];
            for (int i = n - 1; i >= n - 3; i--) {
                copy1[i].rating--;
                if (copy1[i].rating < 0) copy1[i].rating = 0;
                array[copy1[i].index] = true;
            }

            Arrays.sort(copy1);
            print(copy1, debug);
        }

        work(copy1, debug, 1);
        work(copy2, debug, 2);

        ArrayList<Boolean[]> answers = (rating1 > rating2)? answer1 : answer2;

        out.println(Math.max(rating1, rating2));
        if (answers != answer1){
            out.println(answers.size());
        } else {
            out.println(answers.size()+1);
            for (int j=0; j<n; j++) out.print((array[j] != null)? '1' : '0');
            out.println();
        }

        for (int i=0; i<answers.size(); i++){
            Boolean[] array1 = answers.get(i);
            for (int j=0; j<n; j++) out.print((array1[j] != null)? '1' : '0');
            out.println();
        }
    }

    public static ArrayList<Boolean[]> answer1;
    public static ArrayList<Boolean[]> answer2;
    public static int rating1;
    public static int rating2;

    public static void work(Doter[] a, DebugWriter debug, int type){
        int n = a.length;
        Arrays.sort(a);

        ArrayList<Boolean[]> answers = new ArrayList<>();

        while (a[0].rating != a[n-1].rating){
            Boolean[] array = new Boolean[n];

            a[n-2].rating--;
            array[a[n-2].index] = true;
            a[n-1].rating--;
            array[a[n-1].index] = true;

            if (a[n-2].rating < 0) a[n-2].rating = 0;
            if (a[n-1].rating < 0) a[n-1].rating = 0;

            answers.add(array);
            Arrays.sort(a);

            print(a, debug);
        }

        if (type == 1){
            answer1 = answers;
            rating1 = a[0].rating;
        } else {
            answer2 = answers;
            rating2 = a[0].rating;
        }
    }

    public static Doter[] copy(Doter[] doters){
        Doter[] copy = new Doter[doters.length];
        for (int i=0; i<copy.length; i++){
            copy[i] = new Doter(doters[i].rating, doters[i].index);
        }

        return copy;
    }

    public static void print(Doter[] a, DebugWriter debug){
        if (!debug.enable) return;

        for (int i=0; i<a.length; i++){
            debug.print(a[i].rating + " ");
        }
        debug.println("");
    }

    public static class Doter implements Comparable<Doter>{
        int index, rating;

        public Doter(int rating, int index){
            this.rating = rating;
            this.index = index;
        }

        @Override
        public int compareTo(Doter doter) {
            return Integer.compare(rating, doter.rating);
        }
    }

    public static void main(String[] args) throws IOException{
        InputReader in;
        PrintWriter out;
        DebugWriter debug;

        if (args.length > 0 && args[0].equals("file")) {
            in = new InputReader(new BufferedReader(new FileReader("input.txt")));
            out = new PrintWriter(new FileWriter("output.txt"));
            debug = new DebugWriter(true);

            int sampleNumber = 1;
            do {
                String nextSample = "Sample #" + sampleNumber++ + ": ";
                out.println(nextSample);
                debug.println(nextSample);

                solve(in, out, debug);

                out.println("");
                debug.println("");
            } while (in.reader.readLine() != null);
        } else {
            in = new InputReader(new BufferedReader(new InputStreamReader(System.in)));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            debug = new DebugWriter(false);

            solve(in, out, debug);
        }

        in.reader.close();
        out.close();
    }

    public static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(BufferedReader reader) {
            this.reader = reader;
            tokenizer = null;
        }

        public String next() throws IOException{
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }

            return tokenizer.nextToken();
        }

        public int nextInt() throws IOException{
            return Integer.parseInt(next());
        }

        public int[] nextIntArray(int n) throws IOException{
            int[] array = new int[n];
            for (int i=0; i<n; i++){
                array[i] = nextInt();
            }

            return array;
        }
    }

    public static class DebugWriter {
        public boolean enable;

        public DebugWriter(boolean enable){
            this.enable = enable;
        }

        public void print(Object o){
            if (enable) System.out.print(o);
        }

        public void println(Object o){
            if (enable) System.out.println(o);
        }
    }

}