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;
namespace io {
string separator = " ";
}
template <typename T>
inline void write(T x) {
  cout << x << io::separator;
}
template <typename T, typename... Args>
inline void write(T x, Args... args) {
  write(x);
  write(args...);
}
inline void writeln() { cout << '\n'; }
template <typename... Args>
inline void writeln(Args... args) {
  write(args...);
  writeln();
}
template <typename T>
inline void read(T& x) {
  cin >> x;
}
template <typename T, typename... Args>
inline void read(T& x, Args&... args) {
  cin >> x;
  read(args...);
}
template <typename T>
inline void writec(T x) {
  for (auto i = x.begin(); i != x.end(); i++) write(*i);
  writeln();
}
template <typename TL, typename TR>
inline TL GCD(TL a, TR b) {
  TL c;
  while (b) {
    c = b;
    b = a % b;
    a = c;
  }
  return a;
}
template <typename TL, typename TR>
inline TL LCM(TL a, TR b) {
  return a / GCD(a, b) * b;
}
template <typename TL, typename TR>
inline TL MAX(TL a, TR b) {
  return a > b ? a : b;
}
template <typename T, typename... Args>
inline T MAX(T a, Args... args) {
  return MAX(a, MAX(args...));
}
template <typename TL, typename TR>
inline TL MIN(TL a, TR b) {
  return a < b ? a : b;
}
template <typename T, typename... Args>
inline T MIN(T a, Args... args) {
  return MIN(a, MIN(args...));
}
inline int64_t fac(int16_t n) {
  static vector<int64_t> f(1, 1);
  for (auto i = f.size(); i <= n; i++) f.push_back(f.back() * i);
  return f[n];
}
inline int64_t suma(int32_t a1, int32_t d, int32_t n) {
  return n * (2 * a1 + (n - 1) * d) / 2;
}
inline int32_t factor(int32_t n) {
  static vector<int32_t> d(2, 2), prime;
  if (n + 1 > d.size()) {
    int32_t np = d.size() - 1;
    int32_t nn = d.size();
    while (n > nn - 1) nn *= 2;
    nn--;
    d.resize(nn + 1);
    for (auto i = 2; i <= nn; i++) {
      if (!d[i]) {
        d[i] = i;
        prime.push_back(i);
      }
      int64_t x;
      for (int32_t j = 0; prime[j] <= d[i] && j < prime.size() &&
                          (x = (int64_t)i * prime[j]) <= nn;
           j++)
        d[x] = prime[j];
    }
  }
  return d[n];
}
inline bool isprime(int32_t n) { return (factor(n) == n); }
inline int32_t prime(int32_t n) {
  static vector<int32_t> p(1, 2);
  if (n + 1 > p.size()) {
    int32_t np = p.size() - 1;
    int32_t nn = p.size();
    while (n > nn - 1) nn *= 2;
    factor(nn * (log(nn) + log(log(nn))));
    nn--;
    p.resize(nn + 1);
    int32_t x = p[np] + 1;
    for (auto i = np + 1; i <= nn; i++) {
      while (!isprime(x)) x++;
      p[i] = x++;
    }
  }
  return p[n];
}
int32_t MOD = 1e9 + 7;
inline int32_t SUM(int32_t x, int32_t y) { return (x + y) % MOD; }
inline int32_t MUL(int32_t x, int32_t y) { return (int64_t)x * y % MOD; }
inline int32_t POW(int32_t x, int32_t n) {
  int32_t y = 1;
  while (n) {
    if (n % 2) y = MUL(y, x);
    x = MUL(x, x);
    n /= 2;
  }
  return y;
}
inline int32_t INV(int32_t x) { return POW(x, MOD - 2); }
inline int32_t DIV(int32_t x, int32_t y) { return MUL(x, INV(y)); }
inline int32_t P(int32_t l, int32_t r) {
  int32_t x = 1;
  for (auto i = l; i <= r; i++) x = MUL(x, i);
  return x;
}
inline int32_t FAC(int32_t n) { return P(2, n); }
inline int32_t C(int32_t n, int32_t k) { return DIV(P(k + 1, n), P(2, n - k)); }
void solve();
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
inline void solve() {
  int16_t n;
  read(n);
  vector<int16_t> r(n);
  for (auto i = r.begin(); i != r.end(); i++) read(*i);
  int16_t mn = (*min_element(r.begin(), r.end()));
  int16_t mx = (*max_element(r.begin(), r.end()));
  int16_t s = 0;
  for (auto i : r) s += i - mn;
  s -= mx - mn;
  while (s < mx - mn && mn != 0) {
    s += n - 1;
    mn--;
  }
  s += mx - mn;
  if (!mn) {
    s = 0;
    for (auto i : r) s += i;
  }
  (s);
  string ans0(n, '0');
  string ans = ans0;
  writeln(mn);
  if (mn) {
    writeln(s / 2);
    if (s % 2) {
      int16_t i = 0;
      for (auto i_ = 3; i_--;) {
        while (r[i] == mn) i++;
        ans[i] = '1';
        r[i]--;
        i++;
      }
      writeln(ans);
      s -= 3;
    }
    for (auto i_ = s / 2; i_--;) {
      int16_t mxi = distance(r.begin(), max_element(r.begin(), r.end()));
      int16_t i = 0;
      while (r[i] == mn || i == mxi) i++;
      ans = ans0;
      ans[i] = ans[mxi] = '1';
      r[i]--;
      r[mxi]--;
      writeln(ans);
    }
  } else {
    writeln(s);
    for (auto i = 0; i <= n - 1; i++) {
      ans = ans0;
      ans[i] = ans[(i + 1) % n] = '1';
      for (auto i_ = r[i]; i_--;) writeln(ans);
    }
  }
}