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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const long long LINF = 2e16;
const int magic = 348;
const int MOD = 1e9 + 7;
const double eps = 1e-10;
const double pi = acos(-1);
struct fastio {
  static const int S = 1e7;
  char rbuf[S + 48], wbuf[S + 48];
  int rpos, wpos, len;
  fastio() { rpos = len = wpos = 0; }
  inline char Getchar() {
    if (rpos == len) rpos = 0, len = fread(rbuf, 1, S, stdin);
    if (!len) return EOF;
    return rbuf[rpos++];
  }
  template <class T>
  inline void Get(T &first) {
    char ch;
    bool f;
    T res;
    while (!isdigit(ch = Getchar()) && ch != '-') {
    }
    if (ch == '-')
      f = false, res = 0;
    else
      f = true, res = ch - '0';
    while (isdigit(ch = Getchar())) res = res * 10 + ch - '0';
    first = (f ? res : -res);
  }
  inline void getstring(char *s) {
    char ch;
    while ((ch = Getchar()) <= 32) {
    }
    for (; ch > 32; ch = Getchar()) *s++ = ch;
    *s = '\0';
  }
  inline void flush() {
    fwrite(wbuf, 1, wpos, stdout);
    fflush(stdout);
    wpos = 0;
  }
  inline void Writechar(char ch) {
    if (wpos == S) flush();
    wbuf[wpos++] = ch;
  }
  template <class T>
  inline void Print(T first, char ch) {
    char s[20];
    int pt = 0;
    if (first == 0)
      s[++pt] = '0';
    else {
      if (first < 0) Writechar('-'), first = -first;
      while (first) s[++pt] = '0' + first % 10, first /= 10;
    }
    while (pt) Writechar(s[pt--]);
    Writechar(ch);
  }
  inline void printstring(char *s) {
    int pt = 1;
    while (s[pt] != '\0') Writechar(s[pt++]);
  }
} io;
template <typename T>
inline void check_max(T &first, T cmp) {
  first = max(first, cmp);
}
template <typename T>
inline void check_min(T &first, T cmp) {
  first = min(first, cmp);
}
template <typename T>
inline T myabs(T first) {
  return first >= 0 ? first : -first;
}
template <typename T>
inline T gcd(T first, T second) {
  return second == 0 ? first : gcd(second, first % second);
}
inline int add(int first) {
  if (first >= MOD) first -= MOD;
  return first;
}
inline int add(int first, int MO) {
  if (first >= MO) first -= MO;
  return first;
}
inline int sub(int first) {
  if (first < 0) first += MOD;
  return first;
}
inline int sub(int first, int MO) {
  if (first < 0) first += MO;
  return first;
}
inline void Add(int &first, int second) { first = add(first + second); }
inline void Add(int &first, int second, int MO) {
  first = add(first + second, MO);
}
inline void Sub(int &first, int second) { first = sub(first - second); }
inline void Sub(int &first, int second, int MO) {
  first = sub(first - second, MO);
}
template <typename T>
inline int quick_pow(int first, T second) {
  int res = 1;
  while (second) {
    if (second & 1) res = 1ll * res * first % MOD;
    first = 1ll * first * first % MOD;
    second >>= 1;
  }
  return res;
}
template <typename T>
inline int quick_pow(int first, T second, int MO) {
  int res = 1;
  while (second) {
    if (second & 1) res = 1ll * res * first % MO;
    first = 1ll * first * first % MO;
    second >>= 1;
  }
  return res;
}
int n;
int a[148];
vector<bitset<148> > ope;
multiset<pair<int, int> > s;
inline bool check(int cmp) {
  ope.clear();
  s.clear();
  int cnt = 0;
  for (register int i = 1; i <= n; i++)
    if (a[i] - cmp > 0) s.insert(make_pair(a[i] - cmp, i)), cnt += a[i] - cmp;
  if (!cnt) return true;
  if (cnt == 1) return false;
  int cc = ((cnt % 2 == 0) ? cnt / 2 : (cnt - 3) / 2);
  while (cc--) {
    if (int(s.size()) < 2) return false;
    multiset<pair<int, int> >::iterator iter = (--s.end());
    int val1 = iter->first, ind1 = iter->second;
    s.erase(iter);
    iter = (--s.end());
    int val2 = iter->first, ind2 = iter->second;
    s.erase(iter);
    bitset<148> ins;
    ins = 0;
    ins[ind1] = 1;
    ins[ind2] = 1;
    ope.push_back(ins);
    if (val1 > 1) --val1, s.insert(make_pair(val1, ind1));
    if (val2 > 1) --val2, s.insert(make_pair(val2, ind2));
  }
  if (cnt % 2 == 1) {
    if (int(s.size()) != 3) return false;
    bitset<148> ins = 0;
    for (multiset<pair<int, int> >::iterator iter = s.begin(); iter != s.end();
         iter++)
      ins[iter->second] = 1;
    ope.push_back(ins);
  }
  return true;
}
inline void print(int ans) {
  printf("%d\n", ans);
  printf("%d\n", int(ope.size()));
  for (bitset<148> Mask : ope) {
    for (register int i = 1; i <= n; i++)
      if (Mask[i] == 1)
        printf("1");
      else
        printf("0");
    printf("\n");
  }
}
inline void doit_zero() {
  ope.clear();
  for (register int i = 2; i <= n; i++) {
    bitset<148> ins = 0;
    ins[i] = 1;
    ins[1] = 1;
    while (a[i]) {
      ope.push_back(ins);
      a[i]--;
      if (a[1]) a[1]--;
    }
  }
  if (a[1]) {
    bitset<148> ins = 0;
    ins[1] = 1;
    ins[2] = 1;
    while (a[1]) ope.push_back(ins), a[1]--;
  }
  print(0);
}
int main() {
  io.Get(n);
  for (register int i = 1; i <= n; i++) io.Get(a[i]);
  if (n == 1) {
    printf("%d\n", a[1]);
    printf("0\n");
    return 0;
  }
  int minn = a[1], minpos = 1;
  for (register int i = 2; i <= n; i++)
    if (a[i] < minn) minn = a[i], minpos = i;
  for (register int i = a[minpos]; i >= 1; i--)
    if (check(i)) {
      print(i);
      return 0;
    }
  doit_zero();
  io.flush();
  return 0;
}