Polycarpus participates in a competition for hacking into a new secure messenger. He's almost won.

Having carefully studied the interaction protocol, Polycarpus came to the conclusion that the secret key can be obtained if he properly cuts the public key of the application into two parts. The public key is a long integer which may consist of even a million digits!

Polycarpus needs to find such a way to cut the public key into two nonempty parts, that the first (left) part is divisible by a as a separate number, and the second (right) part is divisible by b as a separate number. Both parts should be positive integers that have no leading zeros. Polycarpus knows values a and b.

Help Polycarpus and find any suitable method to cut the public key.


-----Input-----

The first line of the input contains the public key of the messenger — an integer without leading zeroes, its length is in range from 1 to 10^6 digits. The second line contains a pair of space-separated positive integers a, b (1 ≤ a, b ≤ 10^8).


-----Output-----

In the first line print "YES" (without the quotes), if the method satisfying conditions above exists. In this case, next print two lines — the left and right parts after the cut. These two parts, being concatenated, must be exactly identical to the public key. The left part must be divisible by a, and the right part must be divisible by b. The two parts must be positive integers having no leading zeros. If there are several answers, print any of them.

If there is no answer, print in a single line "NO" (without the quotes).


-----Examples-----
Input
116401024
97 1024

Output
YES
11640
1024

Input
284254589153928171911281811000
1009 1000

Output
YES
2842545891539
28171911281811000

Input
120
12 1

Output
NO

Difficulty: interview

Starter code:

Solutions:
def main():
    s, x, pfx = input(), 0, []
    a, b = list(map(int, input().split()))
    try:
        for i, c in enumerate(s, 1):
            x = (x * 10 + ord(c) - 48) % a
            if not x and s[i] != '0':
                pfx.append(i)
    except IndexError:
        pass
    x, p, i = 0, 1, len(s)
    for stop in reversed(pfx):
        for i in range(i - 1, stop - 1, -1):
            x = (x + (ord(s[i]) - 48) * p) % b
            p = p * 10 % b
        if not x:
            print("YES")
            print(s[:i])
            print(s[i:])
            return
    print("NO")


def __starting_point():
    main()

__starting_point()

#zdelano dobrim chelovekom vnizy :D
s, x, pfx = input(), 0, []
a, b = list(map(int, input().split()))
try:
    for i, c in enumerate(s, 1):
        x = (x * 10 + ord(c)-48 ) % a
        
        if not x and s[i] != '0':
            pfx.append(i)
except IndexError:
    pass
x, p, i = 0, 1, len(s)
for stop in reversed(pfx):
    for i in range(i - 1, stop - 1, -1):
        x = (x + (ord(s[i])-48) * p) % b
        p = p * 10 % b
    if not x:
        print("YES")
        print(s[:i])
        print(s[i:])
        return
print("NO")


#zdelano dobrim chelovekom vnizy :D
s, x, pfx = input(), 0, []
a, b = list(map(int, input().split()))
try:
    for i, c in enumerate(s, 1):
        x = (x * 10 + int(c) ) % a
        
        if not x and s[i] != '0':
            pfx.append(i)
except IndexError:
    pass
x, p, i = 0, 1, len(s)
for stop in reversed(pfx):
    for i in range(i - 1, stop - 1, -1):
        x = (x + (int(s[i])) * p) % b
        p = p * 10 % b
    if not x:
        print("YES")
        print(s[:i])
        print(s[i:])
        return
print("NO")


# import sys
# sys.stdin = open("F:\\Scripts\\input","r")
# sys.stdout = open("F:\\Scripts\\output","w")


MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))

s = input()
a , b = I()
n = len(s)
x = [0]*n
y = [0]*n
x[0] = int(s[0])%a
y[n - 1] = int(s[n - 1])%b
p = 10%b
for i in range(1,n):
	x[i] = (x[i-1]*10 + int(s[i]))%a
	y[n - i - 1] = (int(s[n - i - 1])*p + y[n - i])%b
	p *=10
	p %= b
for i in range(n-1):
	if not x[i] and not y[i+1] and (s[i+1] != '0'):
		print("YES",s[:i+1],s[i+1:],sep = '\n')
		break
else:
	print("NO")

'''input
284254589153928171911281811000
1009 1000
'''
from sys import stdin
import math


def check_leading_zero(nstring, index):
	if nstring[index] == '0':
		return False
	return True


def cal_first(nstring, a):
	dp1 = [-1] * len(nstring)
	remain = 0;
	for i in range(len(nstring)):
		dp1[i] = (remain * 10 + int(nstring[i])) % a		
		remain = dp1[i]
	return dp1


def cal_second(nstring, b):
	dp2 = [-1] * len(nstring)
	dp2[-1] = int(nstring[-1]) % b 
	mul = 10
	for i in range(len(nstring) - 2, -1, - 1):
		dp2[i] = ((int(nstring[i]) * mul )+ dp2[i + 1]) % b
		mul = (mul * 10) % b
	return dp2


# main starts
nstring = stdin.readline().strip()
a, b = list(map(int, stdin.readline().split()))
if len(nstring) == 1:
	print("NO")
	return

dp1 = cal_first(nstring, a)
dp2 = cal_second(nstring, b)
#print(dp1, dp2)
for i in range(len(dp1) - 1):
	if dp1[i] == 0 and dp2[i + 1] == 0:
		if check_leading_zero(nstring, i + 1):
			print('YES')
			print(nstring[:i + 1])
			print(nstring[i + 1:])
			return
else:
	print('NO')


s = input()
a, b = map(int, input().split())
n, m = len(s), 0
I, J = set(), set()

for i in range(n - 1):
    m = (10 * m + int(s[i])) % a
    if m == 0:
        I.add(i + 1)

m, k = 0, 1

for i in range(1, n)[::-1]:
    m, k = (m + k * int(s[i])) % b, (10 * k) % b
    if m == 0:
        J.add(i)

for i in I & J:
    if s[i] != '0':
        print('YES', s[:i], s[i:], sep='\n')
        break
else:
    print('NO')

s = input()
a, b = map(int, input().split())
n, m = len(s), 0
I, J = set(), set()

for i in range(n - 1):
    m = (10 * m + int(s[i])) % a
    if m == 0:
        I.add(i + 1)

m, k = 0, 1

for i in range(1, n)[::-1]:
    m, k = (m + k * int(s[i])) % b, (10 * k) % b
    if m == 0:
        J.add(i)

for i in I & J:
    if s[i] != '0':
        print('YES', s[:i], s[i:], sep='\n')
        break
else:
    print('NO')

s = input()
a, b = list(map(int, input().split()))

n = len(s)

flag = 0
p = 0
pfx = []

for i,c in enumerate(s, 1):
    p = (p * 10 + int(c))%a

    if(i < n and p == 0 and s[i] != '0'):
        pfx.append(i)


q = 0
p = 1
i = len(s)

#print(pfx)
for j in  reversed(pfx):
    for i in range(i-1, j -1, -1):
        q = (q + int(s[i]) * p) % b
        p = p * 10 % b
    if not q:
        print("YES")
        print(s[:i])
        print(s[i:])
        return
print("NO")


from math import pow
s=list(input())
a,b=list(map(int,input().split()))
l=len(s)
s1=[0]*(l+1)
s2=[0]*(l+1)
for i in range(l):
	s[i]=ord(s[i])-ord('0')
p=1
for i in range(l-1,-1,-1):
	s1[i]=(s1[i+1]+s[i]*p)%b
	p=(p*10)%b
p=0
for i in range(l-1):
	p=(p*10+s[i])%a
	if p==0 and s1[i+1]==0 and s[i+1]:
		print("YES")
		print(''.join(map(str,s[:i+1])))
		print(''.join(map(str,s[i+1:])))
		return
print("NO")


s = input()
a, b = list(map(int, input().split()))
n = len(s)
flag = 0
p = 0
pfx = []
for i,c in enumerate(s, 1):
    p = (p * 10 + int(c))%a

    if(i < n and p == 0 and s[i] != '0'):
        pfx.append(i)
q = 0
p = 1
i = len(s)
for j in  reversed(pfx):
    for i in range(i-1, j -1, -1):
        q = (q + int(s[i]) * p) % b
        p = p * 10 % b
    if not q:
        print("YES")
        print(s[:i])
        print(s[i:])
        return
print("NO")


def main():
    s, x, pfx = input(), 0, []
    a, b = map(int, input().split())
    try:
        for i, c in enumerate(s, 1):
            x = (x * 10 + int(c)) % a
            if not x and s[i] != '0':
                pfx.append(i)
            #print(c,ord(c) - 48)
    except IndexError:
        pass
    x, p, i = 0, 1, len(s)
    for j in reversed(pfx):
        for i in range(i - 1, j - 1, -1):
            x = (x + (int(s[i])) * p) % b
            p = p * 10 % b
        if not x:
            print("YES")
            print(s[:i])
            print(s[i:])
            return
    print("NO")

def __starting_point():
    main()
__starting_point()

s = input()
a,b = map(int,input().split())
tens = 1
B = 0
A = 0
posa = [False]*(len(s)+1)
posb = [False]*(len(s)+1)
tens = 1
for i in range(len(s)-1,-1,-1):
    
    B+=(int(s[i])*tens)%b
    B = B%b
    if B == 0:
        posb[i] = True
    tens = (tens*10)%b
    
loda = True
for i in range(len(s)-1):
    A = (A*(10%a))%a
    A+=int(s[i])%a
    A = A%a
    if A == 0:
        posa[i] = True
    
    
for i in range(len(s)) :
    if posa[i] ==True and posb[i+1] == True and s[i+1]!='0':
        loda = False
        print("YES")
        print(s[:i+1])
        print(s[i+1:])
        break
        
if loda:
    print("NO")

s = input()
a, b = list(map(int, input().split()))

left = [-1 for i in range(len(s))]
right = [-1 for i in range(len(s))]
x = 0
for i in range(len(s)):
    x = (x * 10 + int(s[i])) % a
    left[i] = x % a
    
x = 0
m = 1
for i in reversed(list(range(0, len(s)))):
    x = (int(s[i]) * m + x) % b
    right[i] = x % b
    m = (m * 10) % b

pos = -1
for i in range(len(s) - 1):
    if left[i] == 0 and right[i + 1] == 0 and s[i + 1] != '0':
        pos = i 
        break
if pos == -1:
    print('NO')
else:
    print('YES')
    print(s[:pos + 1])
    print(s[pos + 1:])


import sys
l = input()
a,b = input().split()
a = int(a)
b= int(b)
n = len(l)
ra = []
rb = [0]*n
nn = ""
f = 0
p = 1
ra.append(int(l[0])%a)
rb[n-1] = (int(l[n-1])%b)
for i in range(1,n-1):
	ra.append((ra[i-1]*10+int(l[i]))%a)
for i in range(n-2,-1,-1):
	rb[i] = (rb[i+1] + (int(l[i])*p*10)%b)%b
	p = (p*10)%b
for i in range(n-1):
	if(ra[i] ==0 and rb[i+1] == 0 and l[i+1] != "0"):
		print("YES")
		print(l[:i+1])
		print(l[i+1:n])
		return
if(f== 0):
	print("NO")

l = input()
a,b = input().split()
a = int(a)
b= int(b)
n = len(l)
ra = []
rb = [0]*n
nn = ""
f = 0
p = 1
ra.append(int(l[0])%a)
rb[n-1] = (int(l[n-1])%b)
for i in range(1,n-1):
	ra.append((ra[i-1]*10+int(l[i]))%a)
for i in range(n-2,-1,-1):
	rb[i] = (rb[i+1] + (int(l[i])*p*10)%b)%b
	p = (p*10)%b
st = ""
for i in range(n-1):
	if(ra[i] ==0 and rb[i+1] == 0 and l[i+1] != "0"):
		print("YES")
		st += str(''.join(l[:i+1]))+"\n"
		st += str(''.join(l[i+1:n]))
		break
if(len(st)== 0):
	print("NO")
else:
	print(st)

l = input()
a,b = input().split()
a = int(a)
b= int(b)
n = len(l)
ra = []
rb = [0]*n
nn = ""
f = 0
p = 1
ra.append(int(l[0])%a)
rb[n-1] = (int(l[n-1])%b)
for i in range(1,n-1):
	ra.append((ra[i-1]*10+int(l[i]))%a)
for i in range(n-2,-1,-1):
	rb[i] = (rb[i+1] + (int(l[i])*p*10)%b)%b
	p = (p*10)%b
for i in range(n-1):
	if(ra[i] ==0 and rb[i+1] == 0 and l[i+1] != "0"):
		print("YES")
		print(l[:i+1])
		print(l[i+1:n])
		f = 1
		break
if(f== 0):
	print("NO")

s = input()
a, b = map(int, input().split())
n, m = len(s), 0
I, J = set(), set()
 
for i in range(n - 1):
    m = (10 * m + int(s[i])) % a
    if m == 0:
        I.add(i + 1)
 
m, k = 0, 1
 
for i in range(1, n)[::-1]:
    m, k = (m + k * int(s[i])) % b, (10 * k) % b
    if m == 0:
        J.add(i)
 
for i in I & J:
    if s[i] != '0':
        print('YES', s[:i], s[i:], sep='\n')
        break
else:
    print('NO')

from math import pow
s=list(input())
a,b=map(int,input().split())
l=len(s)
s1=[0]*(l+1)
s2=[0]*(l+1)
for i in range(l):
	s[i]=ord(s[i])-ord('0')
p=1
for i in range(l-1,-1,-1):
	s1[i]=(s1[i+1]+s[i]*p)%b
	p=(p*10)%b
p=0
for i in range(l-1):
	p=(p*10+s[i])%a
	if p==0 and s1[i+1]==0 and s[i+1]:
		print("YES")
		print(''.join(map(str,s[:i+1])))
		print(''.join(map(str,s[i+1:])))
		return
print("NO")

import sys

inf = float("inf")
# sys.setrecursionlimit(10000000)

# abc='abcdefghijklmnopqrstuvwxyz'
# abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod, MOD = 1000000007, 998244353
# vow=['a','e','i','o','u']
# dx,dy=[-1,1,0,0],[0,0,1,-1]

# import random
# from collections import deque, Counter, OrderedDict,defaultdict
# from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
# from math import ceil,floor,log,sqrt,factorial,pi
# from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right

def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return list(map(int, sys.stdin.readline().strip().split()))
def input(): return sys.stdin.readline().strip()

string = input()
length = len(string)
a,b = get_ints()
dp1 = [0]*length
dp2 = [0]*length
dp1[0] = int(string[0])%a
for i in range(1,length):
    dp1[i] = (dp1[i-1]*10 + int(string[i]))%a
dp2[~0] = int(string[~0])%b
mul = 10
for i in range(1,length):
    dp2[~i] = (int(string[~i])*mul + dp2[~(i-1)])%b
    mul = (mul*10)%b

# print(dp1)
# print(dp2)
for i in range(length-1):
    if dp1[i]==0 and dp2[i+1]==0:
        if string[i+1]!='0':
            print('YES')
            print(string[:i+1])
            print(string[i+1 : ])
            return
print('NO')



def solve(num, a, b):
    rem_a = [None] * len(num)
    rem_b = [None] * len(num)
    sn = num
    num = [int(x) for x in num]
    rem_a[0] = num[0] % a
    rem_b[-1] = num[-1] % b
    q = 1
    for i in range(1, len(num)):
        rem_a[i] = (rem_a[i - 1] * 10 + num[i]) % a
        q = (q * 10) % b
        rem_b[-i - 1] = (num[-i - 1] * q + rem_b[-i]) % b
    for i in range(len(num) - 1):
        if rem_a[i] == 0 and rem_b[i + 1] == 0 and num[i + 1] != 0:
            return True, sn[:i + 1], sn[i + 1:]
    return False, 0, 0


def __starting_point():
    num = input()
    line = input().split()
    a = int(line[0])
    b = int(line[1])
    res, q, w = solve(num, a, b)
    if res:
        print("YES")
        print(q)
        print(w)
    else:
        print("NO")

__starting_point()

def main():
    string = input()
    a,b = list(map(int,input().split()))
    forward = [-1]*len(string)
    backward = [-1]*len(string)
    x=1
    for i in range(len(string)):
        cur = int(string[i])
        j = len(string) - i - 1
        curBack = int(string[j])
        if i==0:
            forward[i] = cur%a
            backward[j] = curBack%b
        else:
            forward[i] = ((forward[i-1]*10)%a + cur%a)%a
            backward[j] = (backward[j+1] + (curBack*x)%b)%b
        x=(x*10)%b

    done = 0
    for i in range(len(string)-1):
        leftMod = forward[i]
        rightMod = backward[i+1]
        if leftMod==0 and rightMod ==0 and int(string[i+1])!=0:
            print("YES")
            print(string[:i+1])
            print(string[i+1:])
            done = 1
            break
    if done==0:
        print("NO")
        # print(forward)
        # print(backward)

main()


s=list(input())
a,b=list(map(int,input().split()))
l=len(s)
s1=[0]*(l+1)
s2=[0]*(l+1)
for i in range(l):
	s[i]=ord(s[i])-ord('0')
p=1
for i in range(l-1,-1,-1):
	s1[i]=(s1[i+1]+s[i]*p)%b
	p=(p*10)%b
p=0
for i in range(l-1):
	p=(p*10+s[i])%a
	if p==0 and s1[i+1]==0 and s[i+1]:
		print("YES")
		print(''.join(map(str,s[:i+1])))
		print(''.join(map(str,s[i+1:])))
		return
print("NO")


from math import pow
s=list(input())
a,b=map(int,input().split())
l=len(s)
s1=[0]*(l+1)
s2=[0]*(l+1)
for i in range(l):
	s[i]=ord(s[i])-ord('0')
p=1
for i in range(l-1,-1,-1):
	s1[i]=(s1[i+1]+s[i]*p)%b
	p=(p*10)%b
p=0
for i in range(l-1):
	p=(p*10+s[i])%a
	if p==0 and s1[i+1]==0 and s[i+1]:
		print("YES")
		print(''.join(map(str,s[:i+1])))
		print(''.join(map(str,s[i+1:])))
		return
print("NO")

s = input()
a,b= map(int,input().split())
l = len(s)
su = [0]*(l+1)
p = 1
flag =0
for i in range(l-1,0,-1):
    su[i] = (su[i+1]+int(s[i])*p)%b
    p = (p*10)%b
p = 0
for i in range(0,l-1):
    p = (p+int(s[i]))%a
    if p==0 and s[i+1]!='0' and su[i+1]==0:
        print('YES')
        print(s[:i+1])
        print(s[i+1:])
        flag =1
        break
    p= (p*10)%a
if flag==0:
    print('NO')