#include <bits/stdc++.h>
using namespace std;
int n;
long long m;
struct Node {
  int nm[8], pd;
} f[106][63][17][17];
bool operator>(Node a, Node b) {
  int la = 0, lb = 0;
  for (int i = 0; i < 8; i++) la += a.nm[i], lb += b.nm[i];
  if (la > lb) return (1);
  if (la < lb) return (0);
  for (int i = 7; i >= 0; i--) {
    if (a.nm[i] > b.nm[i]) return (1);
    if (a.nm[i] < b.nm[i]) return (0);
  }
  return (0);
}
int B[4];
int A[10][4] = {{0, 0, 0, 0}, {0, 0, 0, 0}, {1, 0, 0, 0}, {0, 1, 0, 0},
                {2, 0, 0, 0}, {0, 0, 1, 0}, {1, 1, 0, 0}, {0, 0, 0, 1},
                {3, 0, 0, 0}, {0, 2, 0, 0}};
int main() {
  for (int i = 2; i < 10; i++)
    for (int j = 0; j < 4; j++) A[i][j] += A[i - 1][j];
  scanf("%d", &n);
  scanf("%I64d", &m);
  while (m) {
    int d = m % 10;
    for (int i = 0; i < 4; i++) B[i] += A[d][i];
    m /= 10;
  }
  f[0][0][0][0].pd = 1;
  for (int i = 0; i <= B[0]; i++)
    for (int j = 0; j <= B[1]; j++)
      for (int k = 0; k <= B[2]; k++)
        for (int l = 0; l <= B[3]; l++)
          if (f[i][j][k][l].pd) {
            Node x = f[i][j][k][l];
            for (int d = 2; d <= 9; d++) {
              x.nm[d - 2]++;
              int ii = i + A[d][0], jj = j + A[d][1], kk = k + A[d][2],
                  ll = l + A[d][3];
              if (ii <= B[0] && jj <= B[1] && kk <= B[2] && ll <= B[3])
                if (x > f[ii][jj][kk][ll]) f[ii][jj][kk][ll] = x;
              x.nm[d - 2]--;
            }
          }
  Node rs = f[B[0]][B[1]][B[2]][B[3]];
  for (int i = 9; i >= 2; i--)
    for (int j = 1; j <= rs.nm[i - 2]; j++) printf("%d", i);
  puts("");
}
