#include <bits/stdc++.h>
void printBin(int n, int d);
int main(void) {
  int ptn[] = {63, 6, 91, 79, 102, 109, 125, 39, 127, 111};
  int cur = 0, next;
  while (scanf("%d", &next), next != -1) {
    printBin(cur ^ ptn[next], 7);
    printf("\n");
    cur = ptn[next];
  }
  return 0;
}
void printBin(int n, int d) {
  for (d--; d >= 0; d--) {
    printf("%d", (n >> d) & 1);
  }
}
