import java.io.*;
import java.util.*;
import java.math.*;

public class smooth_aa_time {
	public static void main(String[] args) {
		new smooth_aa_time().run();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	boolean eof = false;
	Random rand = new Random(125475452);

	private void run() {
		Locale.setDefault(Locale.US);
		try {
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(566);
		}
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	void check(boolean u) {
		if (!u) {
			throw new Error("Assertion failed!!!");
		}
	}

	String FNAME = "smooth";

	int MAX = 100;

	private void solve() throws IOException {
		int len = nextInt();
		check(1 <= len && len <= 100);
		int[] a = new int[len];
		int ans = -1;
		long time = System.currentTimeMillis();
		for (int i = 0; i < Math.pow(10, len); i++) {
			if (System.currentTimeMillis() - time > 1800) {
				break;
			}
			int x = i;
			for (int j = 0; j < a.length; j++) {
				a[j] = x % 10;
				x /= 10;
			}
			boolean good = true;
			for (int j = 1; j + 1 < a.length; j++) {
				good &= 2 * a[j] < a[j - 1] + a[j + 1];
			}
			if (good) {
				ans = i;
			}
		}
		out.println(ans);
	}
}