// Задача "Взлом хеж-функции"
// 9-ая Интернет-олимпиада сезона 2007-2008, базовый уровень
// Автор задачи: Федор Царев, tsarev@rain.ifmo.ru
// Автор решения: Федор Царев, tsarev@rain.ifmo.ru

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

public class crack_ft implements Runnable {

	public final static int MAX_N = (int) 2e5;

	private Scanner in;
	private PrintWriter out;
	String fname = "crack";

	private void myAssert(boolean e, String message) {
		if (!e) {
			throw new Error("Assertion failure!!! " + message);
		}
	}
	
	int hash(String s, int x, int m) {
		int t = 1;
		int res = 0;
		for (int i = 0; i < s.length(); i++) {
			res += t * (s.charAt(i) - '0');
			res %= m;
			t *= x;
			t %= m;		
		}
		return res;
	}

	public void solve() {
		int x = in.nextInt();
		myAssert(5 <= x && x <= 100, "");
		for (int i = 2; i < x; i++) {
			if (x % i == 0) {
				myAssert(false, "x is not prime");
			}
		}
		int m = in.nextInt();
		myAssert(1 <= m && m <= 256, "");
		myAssert((m & (m - 1)) == 0, "m is not a power of two");
		int l = in.nextInt();
		myAssert(10 <= l && l <= 100, "");
		int v = in.nextInt();
		myAssert(0 <= v && v < m, "");
		Random r = new Random(343829);
		while (true) {
			StringBuilder sb = new StringBuilder();
			for (int i = 0; i < l; i++) {
				sb.append(r.nextInt(10));
			}
			if (hash(sb.toString(), x, m) == v) {
				out.println(sb.toString());
				break;
			}
		}
	}

	public void run() {
		try {
			solve();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		} finally {
			out.close();
		}		
	}

	public crack_ft() {
		try {
			in = new Scanner(new File(fname + ".in"));
			out = new PrintWriter(new File(fname + ".out"));
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}


	public static void main(String[] args) {
		Locale.setDefault(Locale.US);
		new Thread(new crack_ft()).start();
	}

}                       