Harryxun/stf_run huggingface dataset:
def f(i,s,t):
    if i==3:
        if s==7:
            print(t + '=7')
            exit()
    
    else:
        f(i+1,t+'-'+a[i+1],s-int(a[i+1]))
        f(i+1,t+'+'+a[i+1],s+int(a[i+1]))

a=input()
f(0,int(a[0]),a[0])

### FIXED CODE ###

def dfs(i, f, sum):
    if i == 3:
        if sum == 7:
            # 答えは1つ出力すれば良いので =7 になれば終了
            print(f + "=7")
            exit()

    else:
        # 式 f の末尾に符号と次の数字を追加し、その分 sum に加減する
        dfs(i + 1, f + "-" + s[i + 1], sum - int(s[i + 1]))
        dfs(i + 1, f + "+" + s[i + 1], sum + int(s[i + 1]))


s = input()

dfs(0, s[0], int(s[0]))
s = input()
ans = 0
for i in range(s):
  ans += int(s[0:i]) + int(s[i:len(s)])
ans += int(s)
print(ans)

### FIXED CODE ###

s = input()
l = len(s)
ans = 0
for i in range(2**(l-1)):
    e = ""
    for j in range(l):
        if ((i >> j) & 1):
            e += s[j] + "+"
        else:
            e += s[j]
    ans += eval(e)
print(ans)
a, b = map(int, input().split())
i = 0
count = 0
if b == 1:
    print(0)
else:
    while count < b:
    i += 1
    count = i*a-(i-1)
    
    else:
        print(i)

### FIXED CODE ###

a, b = map(int, input().split())
i = 0
count = 0
if b == 1:
    print(0)
else:
    while count < b:
        i += 1
        count = i*a-(i-1)
    
    else:
        print(i)
s = input()
t = input()
t2 = t[-1] + t[1:]
while t2 != t:
  if s == t2:
    print("yes")
    return 0
  t2 = t[-1] + t[1:]
print("no")

### FIXED CODE ###

s = input()
t = input()
for _ in range(len(t)):
  if s == t:
    print("Yes")
    exit()
  t = t[-1] + t[:-1]
print("No")
from sys import stdin
import datetime
 
i = stdin.readline().strip()
d = map(int, i.split("/"))
print("Heisei" if d <= (2019,4,30) else "TBD")


### FIXED CODE ###

from sys import stdin
 
i = stdin.readline().strip()
d = tuple(map(int, i.split("/")))
print("Heisei" if d <= (2019,4,30) else "TBD")
a,b = list(map(int,input().split()))
if a * b % 2 = 0:
  print(a * b // 2)
else:
  print(a * b // 2 + 1)


### FIXED CODE ###

a,b = list(map(int,input().split()))
if a == 1 or b == 1:
  print(1)
elif a * b % 2 == 0:
  print(a * b // 2)
else:
  print(a * b // 2 + 1)
x=str(input())
if x=="A":
   print("T")
  else if x=="T":
    print("A")
  else if x=="C":
    print("G")
  else if x=="G":
    print("C")

### FIXED CODE ###

x=input()

if x=="A":
  print("T")
elif x=="T":
  print("A")
elif x=="C":
  print("G")
else:
  print("C")
import math
a, b = map(float, input().split()
print(math.floor(a*(b*100)/100)

### FIXED CODE ###

a, b = input().split()
a = int(a)
b = int(b.replace('.', ''))
print(a*b//100)
2
3 1 2
5 100 7

### FIXED CODE ###

_ = int(input())
bef_time = 0
bef_x = 0
bef_y = 0
ans = True

for i in range(_):
    next = input().split()
    next_time = int(next[0])
    next_x = int(next[1])
    next_y = int(next[2])
    time = next_time - bef_time
    range = abs(next_x - bef_x) + abs(next_y - bef_y)

    if (next_time - bef_time) < range:
        ans = False
        break

    if time % 2 == 0:
       if range % 2 != 0:
          ans = False
          break
    else:
       if range % 2 == 0 or range == 0:
          ans = False
          break

    bef_time = next_time
    bef_y = next_y
    bef_x = next_x



if ans == True:
    print('Yes')
else:
    print('No')
N,Y = map(int, input().split(" "))
flag = False
t = int(Y/10000)
for a in range(t+1):
    for b in range(N+1):
        if a+b>N:
            break
        c=N-(a+b)
        tot = a*10000+b*5000+c*1000
        if tot==Y:
            flag=True
            break
    if flag:
        break
if flag:
    print(f'{a} {b} {c}')
else:
    print('-1 -1 -1')


### FIXED CODE ###

N,Y = map(int,input().split(" "))

t = int(Y/10000)
end=False
for x in range(0,t+1):
    for y in range(0,N+1):
        if x+y>N:
            break
        z = N-x-y
        num = x*10000+y*5000+z*1000
        if num==Y:
            print(str(x)+" "+str(y)+" "+str(z))
            end=True
            break
    if end:
        break
if end==False:
    print("-1 -1 -1")
a,b,c = map(int, input()split))

if a < b < c:
print("Yes")
else:
print("No")

### FIXED CODE ###

a, b, c = map(int, input().split())

if a < b < c:
    print("Yes")
else:
    print("No")
h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
for x in range(h):
    for y in range(w):
        if g[y][x]=="#":
            k=0
            for i,j in [(1,0),(-1,0),(0,1),(0,-1)]:
                nx=x+i
                ny=y+j
                if nx<0 or nx>=h or ny<0 or ny>=w:
                   continue
                if g[ny][nx]==".":
                    k+=1
            if k==4:
                print("No")
                exit()
print("Yes")

### FIXED CODE ###

h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
for x in range(h):
    for y in range(w):
        if g[x][y]=="#":
            k=0
            for i,j in [(1,0),(-1,0),(0,1),(0,-1)]:
                nx=x+i
                ny=y+j
                if nx<0 or nx>=h or ny<0 or ny>=w:
                   continue
                if g[nx][ny]==".":
                    k+=1
            if k==4:
                print("No")
                exit()
print("Yes")
a=int(input())
b=int(input())
#a,b = int(input()),int(input())

if 6<=a<=12 :
    ans = b/2

elif 6 > a :
    ans = 0

else :
    ans = b

print(ans)


### FIXED CODE ###

a,b=(int(i) for i in input().split())
#外側はタプルを表してるんだね。
#a,b = int(input()),int(input())

if 6<=a<=12 :
    ans = b/2

elif 6 > a :
    ans = 0

else :
    ans = b

print(int(ans))
import collection

n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)

if c.most_common()[0][1] == 1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import collections

n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)

if c.most_common()[0][1] == 1:
    print("YES")
else:
    print("NO")
print(len(set([int(input()) for _ in range(input())])))

### FIXED CODE ###

print(len(set([int(input()) for _ in range(int(input()))])))
n=int(input())
s=[input() for i in range(n)]
cnt=[0]*5
for t in s:
  if t[0]=='M':
    cnt[0]+=1
  elif t[0]=='A':
    cnt[1]+=1
  elif t[0]=='R':
    cnt[2]+=1
  elif t[0]=='C':
    cnt[3]+=1
  elif t[0]=='H':
    cnt[4]+=1
ans=0
for v in itertools.combinations([0,1,2,3,4],3):
  ans+=cnt[v[0]]*cnt[v[1]]*cnt[v[2]]
print(ans)

### FIXED CODE ###

import itertools
n=int(input())
s=[input() for i in range(n)]
cnt=[0]*5
for t in s:
  if t[0]=='M':
    cnt[0]+=1
  elif t[0]=='A':
    cnt[1]+=1
  elif t[0]=='R':
    cnt[2]+=1
  elif t[0]=='C':
    cnt[3]+=1
  elif t[0]=='H':
    cnt[4]+=1
ans=0
for v in itertools.combinations([0,1,2,3,4],3):
  ans+=cnt[v[0]]*cnt[v[1]]*cnt[v[2]]
print(ans)
n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
town=[0]*n
town[0]=1
b=0
for i in range(k):
	now=a[now]
	if town[now]==1:
		memo=now
		b=1
		break
	lst.append(now)
	town[now]=1
if b==1:
	i=a.index(memo)
	l=len(lst)
	if memo!=0:
		lst=lst[i:]
		l-=len(lst)
		print(lst[(k-l)%len(lst)]+1)
	else:
		print(lst[k%l]+1)

else:
	print(now+1)

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(lambda x:int(x)-1,input().split()))
lst=[0]
now=0
memo=0
town=[0]*n
town[0]=1
b=0
for i in range(k):
	now=a[now]
	if town[now]==1:
		memo=now
		b=1
		break
	lst.append(now)
	town[now]=1
if b==1:
	i=lst.index(memo)
	l=len(lst)
	if memo!=0:
		lst=lst[i:]
		l-=len(lst)
		print(lst[(k-l)%len(lst)]+1)
	else:
		print(lst[k%l]+1)
else:
	print(now+1)
from math import sqrt
a,b,c,d = map(int,input().split())
print(math.sqrt((c-a)**2+(d-b)**2))

### FIXED CODE ###

from math import sqrt
a,b,c,d = map(float,input().split())
print(sqrt((c-a)**2+(d-b)**2))
#! /usr/bin/python
# -*- encoding: utf-8 -*-


if __name__ == '__main__':
    input = list(map(int, input().split()))
    inputA = input[0]
    inputB = input[1]
    
    if inputA < 0:
      print("IMPOSSIBLE")
        
    elif inputB < 0:
      print("IMPOSSIBLE")
        
    elif inputA == inputB:
      print("IMPOSSIBLE")

    elif (inputA + inputB) % 2 == 0:
      print(int((inputA + inputB) / 2))
      
    elif (inputA + inputB) % 2 != 0:
      print("IMPOSSIBLE")

    else:
      print("IMPOSSIBLE")




### FIXED CODE ###

#! /usr/bin/python
# -*- encoding: utf-8 -*-

import sys

if __name__ == '__main__':
    input = list(map(int, input().split()))
    inputA = input[0]
    inputB = input[1]
    
    if inputA < 0:
        sys.stdout.write("IMPOSSIBLE")
        sys.exit()
    
    if inputB < 0:
        sys.stdout.write("IMPOSSIBLE")
        sys.exit()

    if inputA == inputB:
        sys.stdout.write("IMPOSSIBLE")
        sys.exit()

    if (inputA + inputB) % 2 == 0:
        sys.stdout.write(str(int((inputA + inputB) / 2)))
        sys.exit()
      
    sys.stdout.write("IMPOSSIBLE")
    sys.exit()
#https://atcoder.jp/contests/abc150/tasks/abc150_a
K= [ ]
K= int(input())

X= [ ]
X= int(input())

if 500*K<X:
    print("No")
elif 500*K==X:
    print("Yes")
elif 500*K>X:
    print("Yes")

### FIXED CODE ###

#https://atcoder.jp/contests/abc150/tasks/abc150_a

K, X= map(int, input().split())

if 500*K<X:
    print("No")
else:
    print("Yes")
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
s = input()
print("Yes" if s.count["a"]*s.count["b"]*s.count["c"] == 1 else "No")

### FIXED CODE ###

#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
s = input()
print("Yes" if s.count("a")*s.count("b")*s.count("c") == 1 else "No")
import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i%10!=0 ])
print(df)
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
print(sum-10+df)

### FIXED CODE ###

import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i % 10 != 0 ],default=0)
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
if(df == 0):
        print(sum)
else:
        print(sum-df)
N = int(input().split())
count = 0
if N >= 50:
  count+=1
  N-=100
if if N >=5:
  count+=1
  N-=10
if N>0.5:
  count+=1;
print(count)

### FIXED CODE ###

number = int(input())
count = 0
if number >= 50:
  count += 1
if number%100 >= 5:
  count += 1
if number%10 >= 0.5:
  count += 1
print(count)
import math

N = int(input())
A = list(map(int, input().split()))

digit = math.floor(math.log2(max(A))) + 1
bin_A = [format(Ai, '0' + str(digit) + 'b') for Ai in A]

ans = 0

for i in range(digit):
    num0 = 0
    num1 = 0
    for j in range(N):
        if bin_A[j][i] == '1':
            num1 += 1
        else:
            num0 += 1
    ans += ((num1 * num0) * (2**(digit-i-1))) % (10**9+7)

print(ans % (10**9 + 7))


### FIXED CODE ###

import math

N = int(input())
A = list(map(int, input().split()))

ans = 0
fil = 1
for i in range(60):
    num1 = len([1 for j in range(N) if A[j] & fil])
    num0 = N - num1
    ans += (num1 * num0) * fil
    fil <<= 1

print(ans % (10 ** 9 + 7))
s=input()
x=''
for i in s:
    if i=='B':
        if i!='':
            x=x.replace(x[-1],'')
    else:
        x+=i
print(x)

### FIXED CODE ###

s=input()
x=''
for i in s:
    if i=='B':
        if x!='':
            x=x[:-1]
    else:
        x+=i
print(x)
while 1:
  h, w = map(int, raw_input().stlip())
  if H == 0 and W == 0:
    break
  for i in range(h):
    print "#" * w

### FIXED CODE ###

while 1:
  h, w = map(int, raw_input().split())
  if h == 0 and w == 0:
    break
  for i in range(h):
    print "#" * w
  print""
a = int(input())

if a == "ARC" :
    ans = "ABC"
else:
    ans = "ARC"

print(ans)

### FIXED CODE ###

a = input()
 
if a == "ARC" :
    ans = "ABC"
else:
    ans = "ARC"
 
print(ans)
n = int(input())
a = list(map(int,input().split()))
ret = 1
for a_ in a:
  ret *= a_
  if ret_ > 10**18:
    print(-1)
    exit()
print(ret)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
if 0 in a:
    print(0)
    exit()
ret = 1
for a_ in a:
    ret *= a_
    if ret > 10**18:
        print(-1)
        exit()
print(ret)
N = int(input())
S, T = [0]*N, [0]*N
for i in range(N):
  S[i], T[i] = input().split()
X = input()

print(sum(T[S.index(X)+1:]))

### FIXED CODE ###

N = int(input())
s, t = [0]*N, [0]*N
for i in range(N):
  s[i], t[i] = input().split()
X = input()

ans = 0
flag = False
for i in range(N):
  if flag:
    ans += int(t[i])
  if s[i] == X:
    flag = True

print(ans)
import math

N = int(input())

prime = [0 for _ in range(47 + 1)]
lst = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]

for i in range(2, N + 1):
	num = i
	# 素因数分解
	for p in lst:
		while True:
			if num % p == 0:
				num //= p
				prime[p] += 1
			else: break
			if num == 1: break
		

_75 = 0
_25 = 0
_15 = 0
_5 = 0
_3 = 0

for i in range(len(prime)):
	if prime[i] >= 2:
		_3 += 1
	if prime[i] >= 4:
		_5 += 1
	if prime[i] >= 14:
		_15 += 1
	if prime[i] >= 24:
		_25 += 1
	if prime[i] >= 74:
		_75 += 1
		
def comb(a, b):
	return math.factorial(a) / (math.factorial(b) * math.factorial(a - b))
		
ans = 0
ans += _75
ans += (_3 - 1) * _25 # かけられている数で1引いているのは、かける数で使っているものをかけられる数でも使う場合を除くため
ans += (_5 - 1) * _15
ans += (_3 - 2) * comb(_5, 2)

print(int(ans))

### FIXED CODE ###

import math

N = int(input())

prime = [0 for _ in range(47 + 1)]
lst = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]

for i in range(2, N + 1):
	num = i
	# 素因数分解
	for p in lst:
		while True:
			if num % p == 0:
				num //= p
				prime[p] += 1
			else: break
			if num == 1: break
		

_75 = 0
_25 = 0
_15 = 0
_5 = 0
_3 = 0

for i in range(len(prime)):
	if prime[i] >= 2:
		_3 += 1
	if prime[i] >= 4:
		_5 += 1
	if prime[i] >= 14:
		_15 += 1
	if prime[i] >= 24:
		_25 += 1
	if prime[i] >= 74:
		_75 += 1
		
def comb(a, b):
	return math.factorial(a) / (math.factorial(b) * math.factorial(a - b))
		
ans = 0
ans += _75
ans += (_3 - 1) * _25 # かけられている数で1引いているのは、かける数で使っているものをかけられる数でも使う場合を除くため
ans += (_5 - 1) * _15
if _5 >= 2:
	ans += (_3 - 2) * comb(_5, 2)

print(int(ans))
import math
a=input().split()
print(int(a[0]) * int(a[1]) / math.gcd(int(a[0]), int(a[1])))

### FIXED CODE ###

import fractions
a=input().split()
print(int(a[0]) * int(a[1]) // fractions.gcd(int(a[0]), int(a[1])))
x,y = int(input())

print(x*y,x*2+y*2)

### FIXED CODE ###

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

print(a*b,a*2+b*2)
from collections import deque

n=int(input())
g=[[] for i in range(n)]
b=[0]*(n-1)
for i in range(n-1):
    ai,bi=map(int,input().split())
    g[ai-1].append(bi-1)
    g[bi-1].append(ai-1)
    b[i]=bi-1
    
#n=8
#g=[[1], [0, 2, 3, 4], [1], [1, 6], [1, 5], [4, 7], [3], [5]]
#n=6
#g=[[1, 2, 3, 4, 5], [0], [0], [0], [0], [0]]

q=deque([0])

stack=[0]
parent=[-1]*n
pc=[-1]*n
parent[0]=0
dist=[-1]*n
dist[0]=0
while q:
    state = q.popleft()
    ic=0
    for v in g[state]:
        if parent[v] !=-1:
            continue
        else:
            parent[v]=state
            dist[v]=dist[state]+1
            q.append(v)
            ic+=1
            if ic==pc[state]:
                ic+=1
            pc[v]=ic

k=max(pc)
print(k)
for i in range(1,n):
    print(pc[bi[i]])
    

### FIXED CODE ###

from collections import deque

n=int(input())
g=[[] for i in range(n)]
b=[0]*(n-1)
for i in range(n-1):
    ai,bi=map(int,input().split())
    g[ai-1].append(bi-1)
    g[bi-1].append(ai-1)
    b[i]=bi-1
    
#n=8
#g=[[1], [0, 2, 3, 4], [1], [1, 6], [1, 5], [4, 7], [3], [5]]
#b=[1, 2, 3, 4, 6, 5, 7]
#n=6
#g=[[1, 2, 3, 4, 5], [0], [0], [0], [0], [0]]

q=deque([0])

stack=[0]
parent=[-1]*n
pc=[-1]*n
parent[0]=0
dist=[-1]*n
dist[0]=0
while q:
    state = q.popleft()
    ic=0
    for v in g[state]:
        if parent[v] !=-1:
            continue
        else:
            parent[v]=state
            dist[v]=dist[state]+1
            q.append(v)
            ic+=1
            if ic==pc[state]:
                ic+=1
            pc[v]=ic

k=max(pc)
print(k)
for i in range(n-1):
    print(pc[b[i]])
L = [s for s in input()]
if not 'R' in L:
  print(0)
elif not 'S' in L:
  print(3)
elif L[1] == 'S':
  if 'R' in L :
    print(1)
elif L[0] == 'S'
  print(1)
else:
  print(2)
  

### FIXED CODE ###

L = [s for s in input()]
if not 'R' in L:
  print(0)
elif not 'S' in L:
  print(3)
elif L[1] == 'S':
  if 'R' in L :
    print(1)
elif L[0] == 'S':
  if L[2] =='S':
    print(1)
  else:
    print(2)
else:
  print(2)
import numpy as np

a=int(input())
b=list(map(int,input().split()))
b=2*np.array(b)
c=[[0 for s in range(a)] for _ in range(a)]
aa=0
for i in c:
    if aa==a-1:
        i[0]=1
        i[aa]=1
    else:
        i[aa+1]=1
        i[aa]=1
    aa+=1
c=np.array(c)

x=np.linalg.solve(c,b)
x=list(x)
for j in range(len(x)):
    x[j]=int(x[j])
print(" ".join(repr(e) for e in x))


### FIXED CODE ###

a=int(input())
b=list(map(int,input().split()))
c=sum(b[::2])-sum(b[1::2])
d=[c]
for i in b:
    d.append(2*i-c)
    c=2*i-c

d.pop()
print(*d)
s = input()
k = int(input())

sub = []

for i in range(len(s)):
    for j in range(i,len(s)):
            sub.append(s[i:j+1])

sub2 = set(sub)
sub3 = list(sub2)

sub3.sort()

print(sub3[k-1])

### FIXED CODE ###

s = input()
k = int(input())

sub = []

for i in range(len(s)):
    for j in range(1,6):
        if s[i:i+j] not in sub:
            sub.append(s[i:i+j])
            sub.sort()
        if len(sub) > 5:
            sub = sub[:5]

print(sub[k-1])
N,K=map(int, input().split())
h=list(map(int,input().split()))
dp=[float('inf') for i in range(N)]
dp[0]=0
for i in range(1,N):
  for j in range(1,K+1):
    dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[N-1])

### FIXED CODE ###

N,K=map(int, input().split())
h=list(map(int,input().split()))
dp=[float('inf') for i in range(N)]
dp[0]=0
if(N<K):
  K=N-1
for i in range(1,N):
  for j in range(1,K+1):
    dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[N-1])
N = int(input())
pay = (N%1000)
if(pay = 0):
  print(0)
else:
  print(1000 - pay)

### FIXED CODE ###

N = int(input())
pay = (N%1000)
if(pay == 0):
  print(0)
else:
  print(1000 - pay)
S=list(input())
no_flag=0

for i in range(len(S)):
  #print(S)
  if S[0:5] == list("erase"):
    del S[0:5]
    if S[0] == "r":
      del S[0]
    if len(S) == 0:
      break
  if S[0:5] == list("dream"):
    del S[0:5]
    if S[0:2] == list("er"):
      if not len(S) == 2:
      	if not S[2] == "a":
          del S[:2]
      else :
        del S[:2]
    if len(S) == 0:
      break
  else:
    no_flag=1

if no_flag == 0:
  print("YES")
else :
  print("NO")

### FIXED CODE ###

import re
print("YES" if re.match("^(dream|dreamer|erase|eraser)+$",input()) else "NO")
n=int(input())
a=set(map(int,input().split()))
print("YES") if len(a)==n else print("No")

### FIXED CODE ###

s,t=input().split()
a,b=map(int,input().split())
u=input()
print(a-1, b) if u==s else print(a, b-1)
import fraction
N = input()
k = fraction.gcd(2, N)
print(2*N / k)

### FIXED CODE ###

import fractions
N = int(input())
def lcm(x, y):
    return (x * y) / fractions.gcd(x, y)

print(int(lcm(2, N)))
import math
N, M = map(int, input().split())
S = input()
T = input()
g = math.gcd(N, M)
n = N // g
m = M // g
out = n * m * g
for k in range(g):
  if S[k * n] != T[k * m]:
    out = -1
    break
print(out)

### FIXED CODE ###

import fractions
N, M = map(int, input().split())
S = input()
T = input()
g = fractions.gcd(N, M)
n = N // g
m = M // g
out = n * m * g
for k in range(g):
  if S[k * n] != T[k * m]:
    out = -1
    break
print(out)
n = int(input)
count = 0
for i in range(0,n):
  if (i+1)//3==0:
    count = count
  elif (i+1)//5==0:
    count = count
  else:
    count = count + i + 1

print(count)


### FIXED CODE ###

n = int(input())
count = 0
for i in range(0,n):
  if (i+1)%3==0:
    count = count
  elif (i+1)%5==0:
    count = count
  else:
    count = count + i + 1

print(count)
N = input()

A = list(map(int, input().split()))

A.sort()

ans = 0
for a in range(N-2):
    for b in range(a+1, N-1):
        for c in range(b+1, N):
            if A[c] < (A[a] + A[b]):
                ans += 1
            else:
                break

print(ans)

### FIXED CODE ###

import bisect

N = int(input())

A = list(map(int, input().split()))

A.sort()

ans = 0
for a in range(N-2):
    for b in range(a+1, N-1):
        ans += bisect.bisect_left(A, A[a]+A[b])-b-1

print(ans)
s,t = list(input()),list(input())
s.sort()
t.sort(reverse=True)
count = 0
while count < len(s):
  if t[count] > s[0]:
    print("Yes")
    exit()
  else:
    count += 1
print("No")

### FIXED CODE ###

s = list(input())
s.sort()
s = "".join(s)

t = list(input())
t.sort(reverse=True)
t = "".join(t)

if s < t:
  print("Yes")
else:
  print("No")
import math
N, K = map(int,input().split())
MOD = 10**9 + 7

def nCr(n,r):
    if n == 0 or r == 0:
        return 1
    else:
        return (math.factorial(n)//(math.factorial(r)*math.factorial(n-r)))%MOD

for i in range(1,K+1):
    ans = 1
    b = K-i
    ans *= nCr(K-1,i-1)
    ans *= nCr(N-K+1,i)
    print(ans%MOD)


### FIXED CODE ###

import math
N, K = map(int,input().split())
MOD = 10**9 + 7

def nCr(n,r):
    if n <= 0 or r <= 0:
        return 1
    elif n-r < 0:
        return 0
    else:
        return (math.factorial(n)//(math.factorial(r)*math.factorial(n-r)))%MOD

for i in range(1,K+1):
    ans = 1
    b = K-i
    ans *= nCr(K-1,i-1)
    ans *= nCr(N-K+1,i)
    print(ans%MOD)
#!python
# -*- coding: utf-8 -*-

import sys

import numpy as np

sys.setswitchinterval(10**8)


next_s = ((-1, 1), (0, 1), (1, 1),
          (-1, 0), (1, 0),
          (-1, -1), (0, -1), (1, -1))


def DFS(x, y):
    if not (0 <= x < W and 0 <= y < H):
        return
    if not map_[y, x]:
        return

    map_[y, x] = 0

    for dx, dy in next_s:
        DFS(x + dx, y + dy)


while True:
    W, H = map(int, input().split())
    if W == 0 and H == 0:
        break

    map_ = np.array([list(map(int, input().split())) for h in range(H)])
    # print(map_)
    island_num = 0
    while np.amax(map_):
        x = np.argmax(map_) % W
        y = np.argmax(map_) // W
        # print(map_)
        # print("x: {} | y: {}".format(x, y))
        DFS(x, y)
        island_num += 1

    print('\t', island_num)



### FIXED CODE ###

#!python
# -*- coding: utf-8 -*-

import sys

sys.setrecursionlimit(10**6)


next_s = ((-1, 1), (0, 1), (1, 1),
          (-1, 0), (1, 0),
          (-1, -1), (0, -1), (1, -1))


def DFS(x, y):
    if not (0 <= x < W and 0 <= y < H):
        return
    if map_[y][x] == 0:
        return

    map_[y][x] = 0

    for dx, dy in next_s:
        DFS(x + dx, y + dy)


while True:
    W, H = map(int, input().split())
    if W == 0 and H == 0:
        break
    map_ = [list(map(int, input().split())) for h in range(H)]
    island_num = 0
    for x in range(W):
        for y in range(H):
            if map_[y][x] == 1:
                DFS(x, y)
                island_num += 1
    print(island_num)
n, y = map(int,raw_input().split())
y/=1000

h = {0:10, 1:5, 2:1}

mem = {}
def dfs(i, n, y, h,res ):
	if (i,n,y) in mem:
		return mem[(i,n,y)]

	if y < 0:

		mem[(i,n,y)] = False
		return False
	if y == 0:
		if n == 0:
			mem[(i,n,y)] = True
			return True
		mem[(i,n,y)] = False
		return False
	if i == 2:
		if n == y:
			res[2]+= y
			mem[(i,n,y)] = True
			return True
		return False
	res[0] +=1
	if dfs(i, n - 1, y - h[i], h,res):
		mem[(i,n,y)] = True
		return True
	res[0] -= 1

	if dfs(i+1, n ,y, h,res):
		mem[(i,n,y)] = True
		return True
	mem[(i,n,y)] = False
	return False

res = [0,0,0]
if dfs(0, n, y, h, res):
	print ' '.join(map(str,res))
else:
	print ' '.join(map(str,[-1,-1,-1]))

### FIXED CODE ###

n, y = map(int,raw_input().split())
y/=1000


def g(y,n):
	for a in range(y/10 + 1):
		b,c = f(y - a * 10, n - a)
		if b != -1:
			return [a,b,c]
	return [-1,-1,-1]
def f(y,n):
	if y < 0 or n < 0:
		return [-1,-1]
	if y == 0:
		if n == 0:

			return [0,0]
		return [-1,-1]

	for b in range(y/5 + 1):
		if y - b * 5 == n - b and n - b >= 0:
			return [b,n-b]
	return [-1,-1]

print ' '.join(map(str, g(y,n)))