Harryxun/stf_run huggingface dataset:
s=input()
if (int(s[0]+s[1])>12 or  or int(s[0]+s[1])==00) and int(s[2]+s[3])<=12 and int(s[2]+s[3])!=00:
    print("YYMM")
elif int(s[0]+s[1])<=12 and( int(s[2]+s[3])>12 or int(s[2]+s[3])==00) and int(s[0]+s[1])!=00:
    print("MMYY")
elif int(s[0]+s[1])<=12 and int(s[2]+s[3])<=12 and (int(s[0]+s[1])!=00 or int(s[2]+s[3])!=00):
    print("AMBIGUOUS")
else:
    print("NA")

### FIXED CODE ###

s=input()
if (int(s[0]+s[1])>12 or int(s[0]+s[1])==00) and int(s[2]+s[3])<=12 and int(s[2]+s[3])!=00:
    print("YYMM")
elif int(s[0]+s[1])<=12 and( int(s[2]+s[3])>12 or int(s[2]+s[3])==00) and int(s[0]+s[1])!=00:
    print("MMYY")
elif int(s[0]+s[1])<=12 and int(s[2]+s[3])<=12 and (int(s[0]+s[1])!=00 or int(s[2]+s[3])!=00):
    print("AMBIGUOUS")
else:
    print("NA")
N = int(input())
A = [int(input()) for i in range(N)]
for i in A:
    #if A.count(i) >= 1:
    if A.count(i)%2 == 0: 
        A.remove(i)   
print(B)

### FIXED CODE ###

N = input()
print('Yes' if '9' in N else 'No')
import sys
from collections import Counter

#[(105, 3), (120, 1), (106, 1), (119, 1)]
def selection(l1, l2, x ,y):
    
    #print('{}, {}'.format(x, y))
    
    #x yがlengthを超えたとき
    if x >= len(l1) or y >= len(l2):
        return x - 1, y - 1
    
    #それぞれの出現値が同じ場合
    if l1[x][0] == l2[y][0]:
            
        #出現回数が同じとき
        if l1[x][1] == l2[y][1]:
            return selection(l1, l2, x + 1 , y + 1)
    
    #出現回数を比較
    if l1[x][1] > l2[y][1]:
        return x , y - 1
        
    if l1[x][1] < l2[y][1]:
        return x - 1  , y
    
    return x, y

def main():
    input = sys.stdin.readline
    
    n = int(input())
    m = [int(i) for i in input().split()]
    
    even = [m[i] for i, _ in enumerate(m) if i % 2 == 0]
    odd = [m[i] for i, _ in enumerate(m) if i % 2 == 1]
    
    even_c = Counter(even).most_common()
    odd_c = Counter(odd).most_common()
    
    #print(even_c)
    #print(odd_c)
    
    e, o = selection(even_c, odd_c, 0 ,0)
    
    e = 0 if e < 0 else e
    o = 0 if o < 0 else o
    
    #print('{}, {}'.format(e, o))
    
    #全部ばらばら
    if(even_c[e][1] + odd_c[o][1] == 2):
        print(len(m) - 2)
        return
    
    #全部一緒
    if even_c[e][1] == odd_c[o][1] and even_c[e][0] == odd_c[o][0]:
        print(int(len(m) / 2) )
        return
    
    print( len(m) - (even_c[e][1] + odd_c[o][1]) )
    
    
if __name__ == '__main__':
    main()
    

### FIXED CODE ###

import sys
from collections import Counter
 
def main():
    input = sys.stdin.readline
    
    n = int(input())
    m = [int(i) for i in input().split()]
    
    #偶数列 奇数列
    even = [m[i] for i, _ in enumerate(m) if i % 2 == 0]
    odd = [m[i] for i, _ in enumerate(m) if i % 2 == 1]
    
    #頻値を取り出す
    even_c = Counter(even).most_common()
    odd_c = Counter(odd).most_common()
    
    ans = -1
    
    #print(even_c)
    #print(odd_c)
    #print(len(even_c))
    
    #最頻値の比較
    if even_c[0][0] != odd_c[0][0]:
        ans = len(m) - (even_c[0][1] + odd_c[0][1])
    
    #偶数列と奇数列の最頻値の数字が同じかつ、全て同じ数字じゃない
    elif even_c[0][0] == odd_c[0][0] and len(even_c) > 1:
        ans1 = len(m) - (even_c[0][1] + odd_c[1][1])
        ans2 = len(m) - (even_c[1][1] + odd_c[0][1])
        ans = ans1 if ans1 <= ans2 else ans2
    
    #全て同じ
    else:
        ans = even_c[0][1]
        
    #出力
    print(ans)
    
if __name__ == '__main__':
    main()
import numpy as np
N, x = map(int, input().split())
a = np.array(map(int, input().split()))
b = np.copy(a)
ans = float('inf') 
for i in range(N):
    c = np.roll(a,i)
    b = np.minimum(b,c)
    ans = min(ans, sum(b)+i*x)
print(ans)


### FIXED CODE ###

import numpy as np
N, x = map(int, input().split())
a = np.array(list(map(int, input().split())))
b = np.copy(a)
ans = float('inf') 
for i in range(N):
    c = np.roll(a,i)
    b = np.minimum(b,c)
    ans = min(ans, sum(b)+i*x)
print(ans)
a,b=map(int,input().split())
if a*b%2==0:
	print("Even")
else:
	pritn("Odd")

### FIXED CODE ###

a,b=map(int,input().split())
if a*b%2==0:
	print("Even")
else:
	print("Odd")
a = input().split(' ')
 
b = int(a[0]) * int(a[1])
 
if (b < a[2]):
  print(b)
 
else:
  print(a[2])

### FIXED CODE ###

a = input().split(' ')
 
b = int(a[0]) * int(a[1])
 
if (b < int(a[2])):
  print(b)
 
else:
  print(a[2])
import math

A,B,C,D = list(map(int, input().split()))
cc = int(B/C) - int((A-1)/C)
dd = int(B/D) - int((A-1)/D)
cd = C*D / math.gcd(C,D)
ee = int(B/(cd)) - int((A-1)/(cd))
U = B-A+1
print(U - (cc + dd - ee))


### FIXED CODE ###

import fractions
#なぜかWA
"""
A,B,C,D = list(map(int, input().split()))
cc = int(B/C) - int((A-1)/C)
dd = int(B/D) - int((A-1)/D)
cd = int(C*D / fractions.gcd(C,D))
ee = int(B/cd) - int((A-1)/cd)
U = B-A+1
print(U - (cc + dd - ee))
"""
#解説読んだ
#なんで通らなくぁｗせｄｒｆｔｇｙふじこｌｐ
#?????????????????
A,B,C,D = list(map(int, input().split()))
def y(n, c, d):
    cd = c // fractions.gcd(c,d) * d
    cc = n//c
    dd = n//d
    ee = n//cd
    return n - cc - dd + ee

print(y(B, C, D) - y(A-1, C, D))
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
out = 0
if n == 1:
    if a[0] != 0:
        out = 1
elif a[0] == 0:
    for i in range(1,n//2+1):
        if a[2*i-1] == a[2*i] == 2*i:
            None
        else:
            out = 1
elif a[0] == 1:
    for i in range(n//2):
        if a[2*i] == a[2*i+1] == 2*i+1:
            None
        else:
            out = 1
else:
    out = 1
if out:
    print(0)
else:
    print(2**(n//2))

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
a.sort()
out = 0
if n == 1:
    if a[0] != 0:
        out = 1
elif a[0] == 0:
    if n%2 == 0:
        out = 1
    else:
        for i in range(1,n//2+1):
            if a[2*i-1] == a[2*i] and a[2*i] == 2*i:
                None
            else:
                out = 1
elif a[0] == 1:
    if n%2 == 1:
        out = 1
    else:
        for i in range(n//2):
            if a[2*i] == a[2*i+1] == 2*i+1:
                None
            else:
                out = 1
else:
    out = 1
if out:
    print(0)
else:
    a = 1
    for i in range(n//2):
        a *= 2
        a = a%(10**9+7)
    print(a)
from collections import defaultdict
N,M = list(map(int,input().split()))

edges = [[] for _ in range(N)]

for i in range(M):
    L,R,D = list(map(int,input().split()))
    edges[L - 1].append((R -1,D))
    edges[R - 1].append((L-1, -D))


visited = [None] * N
place = [0] * N
inf = 10 ** 10


def walk(i):
    if visited[i]:
        return (i,i)
    visited[i] = True
    (n,m) = ( - inf, inf)
    for j,d in edges[i]:
        if visited[j] and place[j] != place[i] + d:
            print("No")
            exit()
        place[j] = place[i] + d
        (x,y) = walk(j)
        (n,m) = (min(n,x),max(m,y))
    return (n,m)

for i in range(N):
    # 連結成分のminとmax
    (n,m) = walk(i)
    if m -n > 10 ** 9:
        print("No")
        exit()
print("Yes")

### FIXED CODE ###

from sys import exit, setrecursionlimit
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect
 
def read():
  return int(input())
 
def reads():
  return [int(x) for x in input().split()]
 
setrecursionlimit(1000000)
INF = 10**10
 
(N, M) = reads()
 
edges = [[] for _ in range(N)]
 
for _ in range(M):
    (L, R, D) = reads()
    (L, R) = (L-1, R-1)
    edges[L].append((R, D))
    edges[R].append((L, -D))
 
visited = [False] * N
place = [None] * N
 
def walk(i):
    if visited[i]:
        return (place[i], place[i])
    visited[i] = True
    (m, M) = (INF, -INF)
    for (j, d) in edges[i]:
        if visited[j] and place[j] != place[i] + d:
            # print("v = ", visited)
            # print("p = ", place)
            print("No")
            exit()
        place[j] = place[i] + d
        (x, y) = walk(j)
        (m, M) = (min(m, x), max(M, y))
    return (m, M)
 
for i in range(N):
    if not visited[i]:
        place[i] = 0
        (m, M) = walk(i)
        if M - m > 10**9:
            # print("(m, M) = ", (m, M))
            print("No")
            exit()
 
print("Yes")
X = int(input())
for i in range(1, 10**6):
    if X <= 0.5 * i (i + 1):
        print(i)
        break

### FIXED CODE ###

X = int(input())
t = 1
max_t = (t* (t+1)) // 2

# t=1で1 t=2で 2,3 t= 3で 4, 5, 6  t=4で 7,8,9,10  t=5で 11,12,13,14,15までいける

while max_t < X:
    
    t += 1 
    max_t = (t* (t+1)) // 2
    
print(t)
from itertools import combinations
import numpy as np
ans = -1

N, M, X = map(int, input().split())
A = np.ndarray(shape=(N, M), dtype=int)
C = np.ndarray(shape=(N, ), dtype=int)
ans = []
costs = []
money = []
for i in range(N):
    inp = list(map(int, input().split()))
    C[i] = inp[0]
    A[i] = inp[1:]
for r in range(N):
    for c in combinations(range(N), r + 1):
        if min(np.sum(A[list(c)], axis=0)) >= X:
            costs.append(np.sum(C[list(c)]))
if len(costs) == 0:
    print(-1)
else:
    print(min(costs))

### FIXED CODE ###

from itertools import combinations
import numpy as np
ans = -1

N, M, X = map(int, input().split())
A = np.ndarray(shape=(N, M), dtype=int)
C = np.ndarray(shape=(N, ), dtype=int)
ans = []
costs = []
money = []
for i in range(N):
    inp = list(map(int, input().split()))
    C[i] = inp[0]
    A[i] = inp[1:]
for r in range(N):
    for c in combinations(range(N), r + 1):
        if min(np.sum(A[list(c)], axis=0)) >= X:
            costs.append(np.sum(C[list(c)]))
if len(costs) == 0:
    print(-1)
else:
    print(min(costs))
N, M=map(int, input().split())
A = [int(input()) for i in range(M)]

def fib(x):
    a = 1
    b = 1
    if x == 0:
        return 0
    elif x == 1:
        return a
    elif x == 2:
        return b
    else:
        for i in range(x-2):
            c = a + b
            a = b
            b = c
        return b 

before_a=1
output = fib(A[0])
if M>=1:
    for i in range(M-1):
        output *= fib(A[i+1]-A[i]-1)
    output *= fib(N-A[M-1])
else:
    output *= fib(N+1)
print(output%1000000007)

### FIXED CODE ###


N, M=map(int, input().split())
A = [int(input()) for i in range(M)]

def fib(x):
    a = 1
    b = 1
    if x == 0:
        return 0
    elif x == 1:
        return a
    elif x == 2:
        return b
    else:
        for i in range(x-2):
            c = a + b
            a = b
            b = c
        return b 

before_a=1
output=1
if M>=1:
    output = fib(A[0])
    for i in range(M-1):
        output *= fib(A[i+1]-A[i]-1)
    output *= fib(N-A[M-1])
else:
    output *= fib(N+1)
print(output%1000000007)
h, w = map(int,input().split())
arr = [["."] * (w + 2)]
for i in range(w):
    arr += [["."] + list(input()) + ["."]]
arr += [["."] * (w + 2)]

flg = 0    

for j in range(1, h):
    for k in range(1, w):
        if arr[j][k] == "#":
            if arr[j-1][w] == arr[j][w-1] == arr[j+1][w] == arr[j][w+1] == '.':
                flg = 1    
        
if flg == 0:
    print('Yes')
else:
    print('No')
        


### FIXED CODE ###

h, w = map(int,input().split())
arr = [["."] * (w + 2)]
for i in range(h):
    arr += [["."] + list(input()) + ["."]]
arr += [["."] * (w + 2)]

flg = 0    

for j in range(1, h+1):
    for k in range(1, w+1):
        if arr[j][k] == "#":
            if (arr[j-1][k] == '.') and (arr[j][k-1] == '.') and (arr[j+1][k] == '.') and (arr[j][k+1] == '.'):
                flg = 1    
        
if flg == 0:
    print('Yes')
else:
    print('No')
import sys

count = 0

inarr = 10001 * [False]

for line in sys.stdin:
    n = int(line)
    inarr[n] = True

if inarr[2]:
    count += 1


for n in range(3, 10001):
    if not inarr[n]:
        continue

    jdg = True
    for i in range(2, n):
        if n % i == 0:
            jdg = False
            break
    if jdg:
        count += 1
        
print(count)



### FIXED CODE ###

import sys

count = 0

number = int(input())

for line in sys.stdin:
    n = int(line)
    if n == 2:
        count += 1
        continue

    if n % 2 == 0:
        continue

    jdg = True
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i == 0:
            jdg = False
            break
    if jdg:
        count += 1

print(count)
h,w=map(int,input().split())
print([1,sum(divmod(h*w, 2))][h>1<w])


### FIXED CODE ###

a =[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())-1])
N = int(input())
d = list(map(int, input().split()))
ans = 0

from itertools import combinations
for i,j in combinations(N,2):
  ans += d[i]*d[j]
print(ans)
  

### FIXED CODE ###

N = int(input())
d = list(map(int, input().split()))
ans = 0

from itertools import combinations
for i,j in combinations(range(N),2):
  ans += d[i-1]*d[j-1]
print(ans)
A= input()
length=len(A)
B = "9" * (length-1)
A=int(A)
C=A-int(B)
B=str(int(C/10**(length-1)))+B
B=int(B)
B=list(str(B))
B=list(map(int,B))
print(sum(B))

### FIXED CODE ###

A= input()
if len(A)== 1:
	print(A)
	exit()
length=len(A)
B = "9" * (length-1)
A=int(A)
C=A-int(B)
B=str(int(C/10**(length-1)))+B
B=int(B)
B=list(str(B))
B=list(map(int,B))
print(sum(B))
INF = 1<<31
n = input()
l = [0]*(n+1)
for i in xrange(1,n):
    l[i] = input()
dp = [[INF]*2 for i in xrange(n+1)]
dp[1][0] = 0
for i in xrange(1,n):
    for j in xrange(i+1,0,-1):
        dp[j][1] = min(dp[j][1], dp[j][0]+l[i])
        dp[j][0] = min(dp[j-1][0], dp[j-1][1]+l[i])
print min(dp[n/2])

### FIXED CODE ###

INF = 1<<31
n = input()
dp = [[[INF]*2 for _ in xrange(n/2+2)] for _ in range(2)]
dp[1][1][0] = dp[1][0][1] = 0
for i in range(2,n+1):
    x = i % 2
    s = input()
    t = min(i,n/2)
    for j in range(1,t+1):
        dp[x][j][0] = min(dp[1-x][j-1][0], dp[1-x][j-1][1] + s)
        dp[x][j][1] = min(dp[1-x][j][0] + s, dp[1-x][j][1])
print min(dp[0][n/2])
m,n = int(input())
li = list(map(int,input().split()))
if sum(li)>m:
  print(-1)
else:
  print(m - sum(li))

### FIXED CODE ###

m,n = list(map(int,input().split()))
li = list(map(int,input().split()))
if sum(li)>m:
  print(-1)
else:
  print(m - sum(li))
def solve(string):
    ans = 0
    i = 0
    while i < len(string):
        j = 0
        while i + j < len(string) and string[i + j] in "ATGC":
            j += 1
        ans = max(ans, j)
        i += j + 1
    return str(ans)
 
 
if __name__ == '__main__':
    print(solve(input()))
def solve(string):
    ans = 0
    i = 0
    while i < len(string):
        j = 0
        while i + j < len(string) and string[i + j] in "ATGC":
            j += 1
        ans = max(ans, j)
        i += j + 1
    return str(ans)
 
 
if __name__ == '__main__':
    print(solve(input()))


### FIXED CODE ###

def solve(string):
    ans = 0
    i = 0
    while i < len(string):
        j = 0
        while i + j < len(string) and string[i + j] in "ATGC":
            j += 1
        ans = max(ans, j)
        i += j + 1
    return str(ans)
 
 
if __name__ == '__main__':
    print(solve(input()))
n = int(input())
blue = {}
for _ in range(n):
  s = input()
  blue[s] += 1
m = int(input())
red = {}
for _ in range(m):
  t = input()
  red[t] += 1
res = -100
for key, value in blue.items():
  tmp = 0
  if(key in red):
    tmp = blue[key] - red[key]
  else:
    tmp = blue[key]
  if(tmp > res):
    res = tmp
print(res)

### FIXED CODE ###

n = int(input())
blue = {}
for _ in range(n):
  s = input()
  if(s in blue):
    blue[s] += 1
  else:
    blue[s] = 1
m = int(input())
red = {}
for _ in range(m):
  t = input()
  if(t in red):
    red[t] += 1
  else:
    red[t] = 1
res = -100
for key, value in blue.items():
  tmp = 0
  if(key in red):
    tmp = blue[key] - red[key]
  else:
    tmp = blue[key]
  if(tmp > res):
    res = tmp
if(res >= 0):
  print(res)
else:
  print(0)
import math
A,B = input().split()

print(math.gcd(A,B))

### FIXED CODE ###

import fractions
A,B = input().split()
 
lcm = int(A) * int(B)/ fractions.gcd(int(A),int(B))
print(int(lcm))
import numpy as np
N = input()
N = int(N)
H_ = input().split()
H = np.zeros(N)

for i in range(N):
  H[i] = int(H_[N-i-1])
H = np.array(H)
out = []

num = 0
for i in range(N-1):
  if H[i] <= H[i+1]:
    num += 1
  else:
    out.append(num)
    num = 0

print(np.array(out).max())

### FIXED CODE ###

import numpy as np
N = input()
N = int(N)
H_ = input().split()
H = np.zeros(N)

for i in range(N):
  H[i] = int(H_[N-i-1])
out = [0]

num = 0
for i in range(N-1):
  if H[i] <= H[i+1]:
    num += 1
  else:
    out.append(num)
    num = 0
out.append(num)

print(np.array(out).max())
A,B=map(int,input().split())
c = A + B
d = A - B
e = A*B
print(max([c,d,e])

### FIXED CODE ###

A,B=map(int,input().split())
c = A + B
d = A- B
e = A*B
print(max([c,d,e]))
S = input()
count = 0
if S[0] == 'A':
    S = S[1:]
    for i in range(1, len(S)-1):
        if S[i] == 'C':
            S = S[0:i] + S[i+1:]
            if S.islower():
                print('AC')
                break
            else:
                print('WA')
                break
    else:
        print('WA')
        break
else:
    print('WA')

### FIXED CODE ###

S = input()
count = 0
if S[0] == 'A' and 'C' in S[2:-1] and S[1:].replace('C','',1).islower():
    print('AC')
else:
    print('WA')
a,b=map(int,input().split())
if 0 == ((a*b)%2):
  print('even')
else:
  print('Obb’)

### FIXED CODE ###

a,b=map(int,input().split())
if ((a*b)%2) == 0:
  print('Even')
else:
  print('Odd')
a=list(map(int,input().split()))
a.sort()
count=a[2]-a[1]
print(count)
if a[0]-count%2==0:
  print((a[2]-(a[0]+count))//2)
else:
  print(2+(a[2]-(a[0]+count))//2)

### FIXED CODE ###

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

maxans=0
for i in range(n):
  ans=sum(a[0:i+1]+b[i:n])
  maxans=max(ans,maxans)
print(maxans)
N=int(input())
number=list(map(int,input().split()))
Q=int(input())
for i in range(Q):
    B,C=map(int,input().split())
    if B in number:
        for i in range(N):
            if number[i]==B:
                number[i]=C
    print(sum(number))

### FIXED CODE ###

import numpy as np
def cumsum(x):
    return list(np.cumsum(x))

def cumsum_number(N,K,x):
    ans=[0]*(N-K+1)
    number_cumsum = cumsum(x)
    number_cumsum.insert(0,0)
    for i in range(N-K+1):
        ans[i]=number_cumsum[i+K]-number_cumsum[i]
    return ans
"""
int #整数
float #小数

#for
for name in fruits: #fruitの頭から操作
    print(name)

#リスト
list0 = [] #リスト生成
list0 = [1,2,3,4] #初期化
list0 = [0]*10 #[0,0,0,0,0,0,0,0,0,0]
list1= [i for i in range(10)] #>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list1 = list(map(int, input().split()))　# 複数の入力をリストに入れる
number=[int(input()) for i in range(int(input()))] #複数行の入力をリストに
list1 = list1 + [6, 7, 8] #リストの追加
list2.append(34) #リストの追加　最後に（）内が足される
list.insert(3,10) #リストの追加　任意の位置（追加したい位置,追加したい値）
len(list4) #リストの要素数
max(sa) #list saの最小値
list5.count(2) #リスト(文字列も可）内の2の数
list1.sort() #並び替え小さい順
list1.sort(reverse=True)  #並び替え大きい順
set(list1) #list1内の重複している要素を削除し、小さい順に並べる
sum([2,3,   ,3]) #リストの合計

abs(a) #aの絶対値
max(a,b) min(a,b) #最大値　最小値
text1 = text1.replace("34","test") #text1内の"34"を"test"に書き換える(文字列内の文字を入れ替える)
sorted(S) #Sを辞書順にソート
exit(0) #強制終了

cumsum(リスト) #累積和をリストで返す
cumsum_number(N,K,x) #N個の数が含まれるリストx内のK個からなる部分和をリストで返す
"""
N=input()
if N=="A" or N=="B" or N=="C" or N=="D" or N=="E" or N=="F" or N=="G" or N=="H" or N=="I" or N=="J" or N=="K" or N=="L" or N=="M" or N=="N" or N=="O" or N=="P" or N=="Q" or N=="R" or N=="S" or N=="T" or N=="U"or N=="V"or N=="W"or N=="X" or N=="Y" or N=="Z":
    print("A")
else: print("a")
a,b,c = map(int, raw_input().split(" "))
if a > b :
    if a > c :
        if b > c :
            print(%d %d %d)% a b c
        elif c > b :
            print(%d %d %d)% a c b
    else c > a :
        print(%d %d %d)% c a b
elif b > a :
    if b > c :
        if a > c :
            print(%d %d %d)% b a c
        elif c > a :
            print(%d %d %d)% b c a
    else c > b :
        print(%d %d %d)% c b a

### FIXED CODE ###

al = list(map(int, input().split()))
al = sorted(al)
print(al[0],al[1],al[2])
from collections import deque
d = deque()
n = int(input())
for i in range(n):
    s = input().split()
    if str(s[0][6]) =='F': d.popleft()
    elif: str(s[0][6]) =='L':d.pop()
    elif str(s[0][0]) == 'i': d.appendleft(int(s[1]))
    else : 
        if int(s[1]) in d:
            d.remove(int(s[1]))
        else: pass
    
    

print(*d)



### FIXED CODE ###

import collections
a=collections.deque()
for _ in range(int(input())):
    b=input()
    if b[0]=='i':a.appendleft(b[7:])
    elif b[6]==' ':
        try:a.remove(b[7:])
        except:pass
    elif len(b)>10:a.popleft()
    elif len(b)>6:a.pop()
print(*a)
N, *s = map(int, open(0).read().split())
for v in ('AC', 'WA', 'TLE', 'RE'):
    print('{} x {}'.format(v, s.count(v)))


### FIXED CODE ###

N = int(input())
s = [input() for i in range(N)]
for v in ('AC', 'WA', 'TLE', 'RE'):
    print('{} x {}'.format(v, s.count(v)))
# -*- coding: utf-8 -*-

def dfs(num, dem, k, cur_num, prd, p, q, a, n):

    #print num, dem, k, cur_num, prd
    #time.sleep(0.5)
    if num == 0:
        #print "result: " + str(result)
        return 1

    result = 0

    i = cur_num
    while prd * i <= a:
        #print i, num, dem, k, cur_num, prd
        if (n - k) * dem < num * i:
            break
        #if num * i < dem:
        #   i += 1
        #    continue

        result += dfs((num * i) - dem, dem * i, k + 1, i, prd * i, p, q, a, n)
        i += 1

    return result

def func():
    while True:

        p, q, a, n = map(int, raw_input().split())

        if p == 0 and q == 0 and a == 0 and n == 0:
            break

        print dfs(p, q, 0, 1, 1, p, q, a, n)
        
    return None

if __name__ == '__main__':
    func()
    

### FIXED CODE ###

# -*- coding: utf-8 -*-

def dfs(num, dem, k, cur_num, prd, p, q, a, n):

    #print num, dem, k, cur_num, prd
    #time.sleep(0.5)
    if num == 0:
        #print "result: " + str(result)
        return 1

    result = 0

    i = cur_num
    while prd * i <= a:
        #print i, num, dem, k, cur_num, prd
        if (n - k) * dem < num * i:
            break
        if num * i < dem:
            i += 1
            continue

        result += dfs((num * i) - dem, dem * i, k + 1, i, prd * i, p, q, a, n)
        i += 1

    return result

def func():
    while True:

        p, q, a, n = map(int, raw_input().split())

        if p == 0 and q == 0 and a == 0 and n == 0:
            break

        print dfs(p, q, 0, 1, 1, p, q, a, n)
        
    return None

if __name__ == '__main__':
    func()
n=int(input())
route=[[] for i in range(n)]
for i in range(n-1):
	u,v,w=map(int,input().split())
	route[u-1].append((v-1,w))
	route[v-1].append((u-1,w))
ans=[-1]*n
def dfs(p,d):
	ans[p]=d
	for i,j in route[p]:
		if ans[i]<0:dfs(i,(d+j)%2)
dfs(0,0)
for i in range(n):
	print(ans[i])
				

### FIXED CODE ###

import sys
sys.setrecursionlimit(100100)
n=int(input())
route=[[] for i in range(n)]
for i in range(n-1):
	u,v,w=map(int,input().split())
	route[u-1].append((v-1,w))
	route[v-1].append((u-1,w))
ans=[-1]*n
def dfs(p,d):
	ans[p]=d
	for i,j in route[p]:
		if ans[i]<0:dfs(i,(d+j)%2)
dfs(0,0)
for i in range(n):
	print(ans[i])
n,a,b,c=map(int,input().split())
M=10**9+7
m=2*n
fact=[1]*(M+1)
ifact=[1]*(M+1)
r=1
for i in range(1,m+1):fact[i]=r=r*i%M
ifact[m]=r=pow(fact[m],M-2,M)
for i in range(m,0,-1):ifact[i-1]=r=r*i%M
r=pow(a+b,M-2,M) 
p=0
d=b*r%M
e=1
for k in range(n):
    v=fact[n+k-1]*ifact[n-1]*ifact[k]%M*e*(n+k)%M
    e=e*d%M
    p+=v
p*=pow(a*r%M,n,M)*100*r%M
q=0
d=a*r%M
e=1
for k in range(n):
    v=fact[n+k-1]*ifact[n-1]*ifact[k]%M*e*(n+k)%M
    e=e*d%M
    q+=v
q*=pow(b*r%M,n,M)*100*r%M
print((p+q)%M)

### FIXED CODE ###

N, A, B, C = map(int, input().split())

MOD = 10**9 + 7
M = 2*N

fact = [1]*(M+1)
rfact = [1]*(M+1)
r = 1
for i in range(1, M+1):
  fact[i] = r = r * i % MOD
rfact[M] = r = pow(fact[M], MOD-2, MOD)
for i in range(M, 0, -1):
  rfact[i-1] = r = r * i % MOD

rev = pow(A+B, MOD-2, MOD)

p = 0
b = B * rev % MOD
e = 1
for k in range(N):
    v = fact[N+k-1] * rfact[N-1] * rfact[k] % MOD
    v = v * e * (N + k) % MOD
    e = e * b % MOD
    p += v
p *= pow(A * rev % MOD, N, MOD) * 100 * rev % MOD

q = 0
b = A * rev % MOD
e = 1
for k in range(N):
    v = fact[N+k-1] * rfact[N-1] * rfact[k] % MOD
    v = v * e * (N + k) % MOD
    e = e * b % MOD
    q += v
q *= pow(B * rev % MOD, N, MOD) * 100 * rev % MOD

print((p + q) % MOD)