import java.util.*; import java.io.*; public class Main { public static Scanner sc = new Scanner(System.in); public static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) { int T = 1; while( T > 0 ) { solve(); T--; } pw.flush(); } static void solve() { long p = sc.nextLong(); long q = sc.nextLong(); long x = sc.nextLong(); long y = sc.nextLong(); long t = Long.toString(q).length(); long revq = Long.valueOf(new StringBuilder(Long.toString(q)).reverse().toString()); long revqx = Long.valueOf(new StringBuilder(Long.toString(q+x)).reverse().toString()); long m = revqx; pw.println(revqx); while( m > 0 ) { long pow = modpow(10,t,p); m *= pow; m %= p; m += revq; m %= p; pw.print(revq); } } static long modpow( long x, long n, long mod ) { if( n == 0 ) { return 1; } long k = 1; while( n > 1 ) { if( n%2 == 1 ) k *= x; x *= x; n /= 2; x %= mod; k %= mod; } return (k*x)%mod; } }