import java.util.Scanner; public class Main_yukicoder294_1 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][][] dp = new int[2][3][26]; dp[1][2][1] = 1; int[] d = {3, 5}; for (int i = 1; i < 25; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 3; k++) { for (int l = 0; l < 2; l++) { dp[l][(k + d[l]) % 3][i + 1] += dp[j][k][i]; } } } } int i = 0; int j = 0; int sum = 0; out: for (i = 1; i < 26; i++) { for (j = 0; j < 2; j++) { if (n - dp[j][sum][i] <= 0) { break out; } n -= dp[j][sum][i]; } } String ret = Integer.toString(d[j]); for (i--; i > 0; i--) { for (int k = 0; k < 2; k++) { if (n - dp[k][(sum + 6 - d[j]) % 3][i] <= 0) { sum -= d[j]; sum += 6; j = k; ret += d[k]; break; } else { n -= dp[k][(sum + 6 - d[j]) % 3][i]; } } } System.out.println(ret); sc.close(); } }