#include <bits/stdc++.h>
int main() {
  int N, x;
  int A[8] = {0, 0, 0, 0, 0, 0, 0};
  int n[8] = {0, 0, 0, 0, 0, 0, 0};
  int n0[8] = {0, 1, 1, 1, 1, 1, 1};
  int n1[8] = {0, 0, 0, 0, 1, 1, 0};
  int n2[8] = {1, 0, 1, 1, 0, 1, 1};
  int n3[8] = {1, 0, 0, 1, 1, 1, 1};
  int n4[8] = {1, 1, 0, 0, 1, 1, 0};
  int n5[8] = {1, 1, 0, 1, 1, 0, 1};
  int n6[8] = {1, 1, 1, 1, 1, 0, 1};
  int n7[8] = {0, 1, 0, 0, 1, 1, 1};
  int n8[8] = {1, 1, 1, 1, 1, 1, 1};
  int n9[8] = {1, 1, 1, 1, 1, 1, 1};
  while (1) {
    scanf("%d", &N);
    if (N == -1) break;
    for (int i = 0; i < 7; i++) A[i] = 0;
    for (int i = 0; i < N; i++) {
      scanf("%d", &x);
      switch (x) {
        case 0:
          for (int i = 0; i < 7; i++) n[i] = n0[i];
          break;
        case 1:
          for (int i = 0; i < 7; i++) n[i] = n1[i];
          break;
        case 2:
          for (int i = 0; i < 7; i++) n[i] = n2[i];
          break;
        case 3:
          for (int i = 0; i < 7; i++) n[i] = n3[i];
          break;
        case 4:
          for (int i = 0; i < 7; i++) n[i] = n4[i];
          break;
        case 5:
          for (int i = 0; i < 7; i++) n[i] = n5[i];
          break;
        case 6:
          for (int i = 0; i < 7; i++) n[i] = n6[i];
          break;
        case 7:
          for (int i = 0; i < 7; i++) n[i] = n7[i];
          break;
        case 8:
          for (int i = 0; i < 7; i++) n[i] = n8[i];
          break;
        case 9:
          for (int i = 0; i < 7; i++) n[i] = n9[i];
          break;
      }
      for (int i = 0; i < 7; i++) {
        if (A[i] != n[i])
          printf("1");
        else if (A[i] == n[i])
          printf("0");
        A[i] = n[i];
      }
      printf("\n");
    }
  }
  return 0;
}
