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

public class crack_dp implements Runnable {

    public static final int MIN_POW = 5;
    public static final int MAX_POW = 100;
    public static final int MAX_MOD = 256;
    public static final int MIN_LEN = 10;
    public static final int MAX_LEN = 100;

    private Scanner in;
    private PrintWriter out;

    private Random random = new Random();

    private boolean isPrime(int n) {
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }

    private int getHash(int[] str, int pow, int mod) {
        int res = 0;
        for (int i = 0, p = 1; i < str.length; i++) {
            res = (res + str[i] * p) % mod;
            p = (p * pow) % mod;
        }
        return res;
    }

    public void solve() {
        int pow = in.nextInt();
        assert MIN_POW <= pow && pow <= MAX_POW && isPrime(pow);
        int mod = in.nextInt();
        assert 1 <= mod && mod <= 256 && (mod & (mod - 1)) == 0;
        int len = in.nextInt();
        assert MIN_LEN <= len && len <= MAX_LEN;
        int val = in.nextInt();
        assert 0 <= val && val < mod;
        int[] answer = new int[len];
        while (true) {
            for (int i = 0; i < len; i++) {
                answer[i] = random.nextInt(10);
            }    
            int hash = getHash(answer, pow, mod);
            if (val == hash) {
                for (int i = 0; i < len; i++) {
                    out.print(answer[i]);
                }    
                out.println();
                break;
            }
        }
    }

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

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


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

}                       