Harryxun/stf_run huggingface dataset:
import sympy
def piyo():
    n = int(input())
    if (n-7)%4==0 or (n-14)%4==0 or (n-21)%4==0 or n%4==0:
        print("Yes")
        return
    print("No")
        
if __name__ == '__main__':
    piyo()

### FIXED CODE ###

def piyo():
    n = int(input())
    if n>=24:
        if ((n-7)%4==0 or (n-14)%4==0 or (n-21)%4==0 or n%4==0
        or (n-4)%7==0 or (n-8)%7==0 or (n-12)%7==0 or (n-16)%7==0 or (n-20)%7==0 or (n-24)%7==0 or n%7==0):
            print("Yes")
            return
    if n>=21:
        if ((n-7)%4==0 or (n-14)%4==0 or (n-21)%4==0 or n%4==0
        or (n-4)%7==0 or (n-8)%7==0 or (n-12)%7==0 or (n-16)%7==0 or (n-20)%7==0 or n%7==0):
            print("Yes")
            return
    if n>=20:
        if ((n-7)%4==0 or (n-14)%4==0 or n%4==0 or (n-4)%7==0 or (n-8)%7==0 or (n-12)%7==0 or (n-16)%7==0 or (n-20)%7==0 or n%7==0):
            print("Yes")
            return
    if n>=16:
        if ((n-7)%4==0 or (n-14)%4==0 or n%4==0 or (n-4)%7==0 or (n-8)%7==0 or (n-12)%7==0 or (n-16)%7==0 or n%7==0):
            print("Yes")
            return
    if n>=14:
        if ((n-7)%4==0 or (n-14)%4==0 or n%4==0 or (n-4)%7==0 or (n-8)%7==0 or (n-12)%7==0 or n%7==0):
            print("Yes")
            return
    if n>=12:
        if ((n-7)%4==0 or n%4==0 or (n-4)%7==0 or (n-8)%7==0 or (n-12)%7==0 or n%7==0):
            print("Yes")
            return
    if n>=8:
        if ((n-7)%4==0 or n%4==0 or (n-4)%7==0 or (n-8)%7==0 or n%7==0):
            print("Yes")
            return
    if n>=7:
        if ((n-7)%4==0 or n%4==0 or (n-4)%7==0 or n%7==0):
            print("Yes")
            return
    if n>=4:
        if (n%4==0 or (n-4)%7==0 or n%7==0):
            print("Yes")
            return
    print("No")
        
if __name__ == '__main__':
    piyo()
import sys
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, csgraph_from_dense
import itertools

input = sys.stdin.readline


def main():
    N, M, R = [int(x) for x in input().split()]
    r = [int(x) - 1 for x in input().split()]
    ABC = [[int(x) for x in input().split()] for _ in range(M)]

    EDGE = [[10 ** 9] * N for j in range(N)]

    for a, b, c in ABC:
        EDGE[a - 1][b - 1] = c
        EDGE[b - 1][a - 1] = c

    G = csgraph_from_dense(EDGE, null_value=10 ** 9)

    d = floyd_warshall(G)

    ans = float("inf")
    for a in itertools.permutations(r):
        tmp = 0
        c = a[0]
        for n in a:
            tmp += int(d[c][n])
            c = n
        ans = min(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, csgraph_from_dense
import itertools

input = sys.stdin.readline


def main():
    N, M, R = [int(x) for x in input().split()]
    r = [int(x) - 1 for x in input().split()]
    ABC = [[int(x) for x in input().split()] for _ in range(M)]

    EDGE = [[10 ** 9] * N for j in range(N)]

    for a, b, c in ABC:
        EDGE[a - 1][b - 1] = c
        EDGE[b - 1][a - 1] = c

    G = csgraph_from_dense(EDGE, null_value=10 ** 9)

    d = floyd_warshall(G)

    ans = float("inf")
    for a in itertools.permutations(r):
        tmp = 0
        c = a[0]
        for n in a:
            tmp += int(d[c][n])
            c = n
        ans = min(ans, tmp)

    print(ans)


if __name__ == '__main__':
    main()
N = int(input())
A = [abs(int(input())) for _ in range(N)]
#A.sort()
s = sum(A)

def mulmod(p,q,mod):
  return ((p%mod)*(q%mod))%mod
def powermod(p,n,mod):
  if n==0: return 1
  if n==1: return p%mod
  else:    return powermod(p,n//2,mod)**2 * (p**(n%2)) %mod
def dividemod(p,q,mod):
  # modは素数
  return mulmod(p, powermod(q,mod-2,mod), mod)

mod = 998244353

import numpy as np

dp = [np.zeros(s+1) for _ in range(N)]


# dp[n][s] An-1(0-index)まで加えて、Rの和がsになるのが何通りか（残りのG,Bまで含めて）
dp[0][0] = 2
dp[0][A[0]] = 1
temp_sum = A[0]

for i in range(1,N):
  dp[i] = np.mod((np.roll(dp[i-1], A[i]) + dp[i-1]*2), mod)
  temp_sum += A[i]

def part_sum(a,A):
  p=mod
  #初期化
  N=len(a)
  dp=[[0 for i in range(A+1)] for j in range(N+1)]
  dp[0][0]=1

  #DP
  for i in range(N):
    for j in range(A+1):
      if a[i]<=j: #i+1番目の数字a[i]を足せるかも
        dp[i+1][j]=dp[i][j-a[i]]+ dp[i][j]% p
      else: #入る可能性はない
        dp[i+1][j]=dp[i][j]%p
  return dp[N][A]

ps = part_sum(A, s//2)

if s%2 != 0:
    answer = (powermod(3, N, mod) - 3*sum(dp[N-1][(s+1)//2:]))%mod
else:
    answer = (powermod(3, N, mod) - 3*(sum(dp[N-1][(s+1)//2:]) - ps))%mod

answer = int(answer)

print(answer)


### FIXED CODE ###

N = int(input())
A = [abs(int(input())) for _ in range(N)]
#A.sort()
s = sum(A)

def mulmod(p,q,mod):
  return ((p%mod)*(q%mod))%mod
def powermod(p,n,mod):
  if n==0: return 1
  if n==1: return p%mod
  else:    return powermod(p,n//2,mod)**2 * (p**(n%2)) %mod
def dividemod(p,q,mod):
  # modは素数
  return mulmod(p, powermod(q,mod-2,mod), mod)

mod = 998244353

dp = [[0]*(s+1) for _ in range(N)]
# dp[n][s] An-1(0-index)まで加えて、Rの和がsになるのが何通りか（残りのG,Bまで含めて）
dp[0][0] = 2
dp[0][A[0]] = 1
temp_sum = A[0]

for i in range(1,N):
  for j in range(A[i]):
    dp[i][j] = (dp[i-1][j]*2) %mod
  for j in range(A[i], temp_sum+1):
    dp[i][j] = (dp[i-1][j]*2 + dp[i-1][j-A[i]]) %mod
  for j in range(temp_sum+1, temp_sum+1 + A[i]):
    dp[i][j] = (dp[i-1][j-A[i]]) %mod
  temp_sum += A[i]


def part_sum(a,A):
  p=mod
  #初期化
  N=len(a)
  dp=[[0 for i in range(A+1)] for j in range(N+1)]
  dp[0][0]=1

  #DP
  for i in range(N):
    for j in range(A+1):
      if a[i]<=j: #i+1番目の数字a[i]を足せるかも
        dp[i+1][j]=dp[i][j-a[i]]+ dp[i][j]% p
      else: #入る可能性はない
        dp[i+1][j]=dp[i][j]%p
  return dp[N][A]

ps = part_sum(A, s//2)

if s%2 != 0:
    answer = (powermod(3, N, mod) - 3*sum(dp[N-1][(s+1)//2:]))%mod
else:
    answer = (powermod(3, N, mod) - 3*(sum(dp[N-1][(s+1)//2:]) - ps))%mod



print(answer)
import itertools
import math

n = int(input())
lis = [x for x in range(1,n+1)]  #順列とる数列
xy = [list(map(int,input().split())) for i in range(n)]　#座標をメモ
permutations_lis = itertools.permutations(lis)　#順列とって
l = list(permutations_lis)#全順列のリストを作る
ans = 0

for onecase in l: 
  s = 0
  for j in range(n-1):
    s += math.sqrt((xy[onecase[j]-1][0]-xy[onecase[j+1]-1][0])**2 + (xy[onecase[j]-1][1]-xy[onecase[j+1]-1][1])**2)
  ans += s
  
print(ans/math.factorial(n))

### FIXED CODE ###

import itertools
import math

n = int(input())
lis = [x for x in range(1,n+1)] 
xy = [list(map(int,input().split())) for i in range(n)]
permutations_lis = itertools.permutations(lis)
l = list(permutations_lis)
ans = 0

for onecase in l: 
  s = 0
  for j in range(n-1):
    s += math.sqrt((xy[onecase[j]-1][0]-xy[onecase[j+1]-1][0])**2 + (xy[onecase[j]-1][1]-xy[onecase[j+1]-1][1])**2)
  ans += s
  
print(ans/math.factorial(n))
import numpy as np

H, W, M = map(int, input().split())
map_ = np.zeros((H, W))

for _ in range(M):
    h, w = map(int, input().split())
    map_[h-1, w-1] = 1

sum_h = np.sum(map_, axis=1)
sum_w = np.sum(map_, axis=0)
ans = 0

for h in range(H):
    for w in range(W):
        ans = max(sum_h[h] + sum_w[w] - map_[h, w], ans)

print(int(ans))

### FIXED CODE ###

# import numpy as np

H, W, M = map(int, input().split())
#map_ = np.zeros((H, W), dtype=np.bool)

h_sum = [0] * H
w_sum = [0] * W
point_list = set()

for _ in range(M):
    h, w = map(int, input().split())
    # map_[h-1, w-1] = 1
    point_list.add((h-1, w-1))
    h_sum[h-1] += 1
    w_sum[w-1] += 1

h_max = max(h_sum)
w_max = max(w_sum)

h_argmax = set()
w_argmax = set()

for i, h in enumerate(h_sum):
    if h == h_max:
        h_argmax.add(i) 

for i, w in enumerate(w_sum):
    if w == w_max:
        w_argmax.add(i)

ans = h_max + w_max

for h in h_argmax:
    for w in w_argmax:
        if (h, w) not in point_list:
        # if map_[h, w] == 0:
            print(ans)
            exit()
print(ans - 1)
@patch('builtins.input', test.test_input)
def main():
    z = [-1] * 10
    xy = []
    n = int(input())
    for _ in range(n):
        a = int(input())
        xy.append([list(map(int, input().split())) for _ in range(a)])
    ans = 0
    print(0)
        
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    xy = []
    n = int(input())
    for _ in range(n):
        a = int(input())
        xy.append([list(map(int, input().split())) for _ in range(a)])
    ans = 0
    
    for a in range(2**n):
        c = []
        for b in range(n):
            c.append(a >> b & 1)
       
        flag = True
        for i in range(n):
            if c[i] == 1:
                for x, y in xy[i]:
                    if c[x - 1] != y:
                        flag = False
                        
        if flag:
            ans = max(ans, sum(c))
    
    print(ans)
        
    
if __name__ == '__main__':
    main()
A,B =map(int,input().split())
hih=0
num=1
S=int(input())
S= list(str(S))
for s in S:
    if s=="-":
        hih=num
    num+=1
if hih==A:
    print("Yes")
else:
    print("No")

### FIXED CODE ###


A,B =map(int,input().split())
hih=0
num=1
test=1
S=str(input())
S= list(S)
for s in S:
    if num==A+1 and s=="-":
        hih=1
    if num!=A+1 and s=="-":
        test=0
        
    
    num+=1
if hih==1 and test==1:
    print("Yes")
else:
    print("No")
n,k=map(int,input().split())
LIST=list(map(int,input().split()))
kazu=0
for i in LIST:
  if i>=k:
    kazu=kazu+1
print (kazu)

### FIXED CODE ###

n=int(input())
cnt=0
ans=0
for i in range(1,n+1):
  cnt+=1
  if i%2==1:
    ans+=1
    
print(ans/cnt)
import math
X = 2*R*math.pi

### FIXED CODE ###

import math
R = int(input())
print(2*math.pi*R)
N, K = map(int, input().split())
al = list(map(int, input().split()))

route = [1]
for i in range(N):
    next_town = al[route[i]-1]
    if len(route) != len(set(route)):
        loop_start = route.index(next_town)
        loop_end = len(route)
        loop_length = loop_end - loop_start
        if K >= loop_end:
            amari = (K - loop_start)%loop_length
            ans = route[loop_start + amari]
            #print(route)
            print(ans)
            exit()
    else:
        route.append(next_town)

ans = route[-1]
print(ans)


### FIXED CODE ###

from collections import defaultdict


def inpl():
    return list(map(int, input().split()))


N, K = inpl()
aa = inpl()

s = 1

route = [s]
ed = set([s])

for i in range(1, K + 1):
    s = aa[s - 1]
    if s in ed:
        Li = route.index(s)
        Ri = len(route)
        idx = Li + (K - Li) % (Ri - Li)
        print(route[idx])
        break
    else:
        route.append(s)
        ed.add(s)
        continue
else:
    print(s)
import sys
(h, w) = map(int, input().split())
sw = [['.' for i in range(h + 2)]]
for i in range(w):
    sw.append(['.'] + list(input()) + ['.'])
sw.append(['.' for i in range(h + 2)])

dirs = [[1, 0], [-1, 0], [0, 1], [0, -1]]
for i in range(1, w + 1):
    for j in range(1, h + 1):
        if sw[i][j] == '.':
            continue
        ok = False
        for dir in dirs:
            if sw[i + dir[0]][j + dir[1]] == '#':
                ok = True
                break
        if ok == False:
            print('No')
            sys.exit(0)
print('Yes')

### FIXED CODE ###

import sys
(h, w) = map(int, input().split())
D = '.'
sw = []
sw.append([D for i in range(w + 2)])
for i in range(h):
    sw.append([D] + list(input()) + [D])
sw.append([D for i in range(w + 2)])

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if sw[i][j] == D:
            continue
        ok = False
        for dir in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
            if sw[i + dir[0]][j + dir[1]] == '#':
                ok = True
                break
        if ok == False:
            print('No')
            sys.exit(0)
print('Yes')
input = input().split()
N = int(input[0])
S = input[1]
 
R = 0
B = 0
h = 'No'
 
for i in N:
  if S[i] == 'R':
    R += 1
  else:
    B += 1
if R > B:
  h = 'Yes'
print(h)

### FIXED CODE ###

input1 = input()
N = int(input1)
input2 = input()
S = list(input2)
 
R = 0
B = 0
h = 'No'
 
for i in range(N):
  if S[i] == 'R':
    R += 1
  else:
    B += 1
  
if R > B:
  h = 'Yes'

print(h)
n,m=map(int,input().split())
l=list(map(int,input().split()))
count=0
if l[i]>m:
  count+=m-l[i]
  l[i]=m
for i in range(1,n):
  if l[i-1]+l[i]>m:
    count+=l[i]+l[i-1]-m
    l[i]=m-l[i-1]   
print(count)

### FIXED CODE ###

n,m=map(int,input().split())
l=list(map(int,input().split()))
count=0
if l[0]>m:
  count+=-m+l[0]
  l[0]=m
for i in range(1,n):
  if l[i-1]+l[i]>m:
    count+=l[i]+l[i-1]-m
    l[i]=m-l[i-1]   
print(count)
n = input()
k = int(input())
ar = list(map(int, input().split()))
ans = 0
for i in ar:
  if i <= k:
    ans+= 1
print(ans)

### FIXED CODE ###

n,k = map(int, input().split())
ar = list(map(int, input().split()))
ans = 0
for i,v in enumerate(ar):
  if v >= k:
    ans+= 1
print(ans)
n, m = (int(x) for x in input().split())
d = [[] for _ in range(m)]
py = []
for i in range(m):
    py.append([int(x) for x in input().split()])
    d[py[i][0]-1].append(py[i][1])
for li in d:
    li.sort()
for li in py:
    print(str(li[0]).zfill(6) + str(d[li[0]-1].index(li[1])+1).zfill(6))

### FIXED CODE ###

import bisect as bis
n, m = map(int, input().split())
idx = lambda x: x-1
p, y = [], []
for _ in range(m):
    p_, y_ = map(int, input().split())
    p.append(p_)
    y.append(y_)
val = [[] for _ in range(n)]
for i, j in zip(p, y):
    val[idx(i)].append(j)
for i in range(n):
    val[i].sort()
for i in range(m):
    v = p[i]
    id = bis.bisect_right(val[idx(v)], y[i])
    print(str(v).zfill(6) + str(id).zfill(6))
s=input()
temp=0
tem=0
tot=0
if len(s)>10**3:
        
    for i in range(len(s)):
        tem=1
        temp=1
        flag=0
        for j in range(i+1,len(s)):
            if s[j]==s[i]:
                temp+=1
            tem+=1
            if temp>(tem//2 ):
                print(i+1,j+1)
                
                flag=1
                tot=1
                break
        if flag:
            break
    if tot==0:
        print("-1 -1")
else:
    for i in range(len(s)-2):
        if s[i]==s[i+1]:
            print(i+1,i+2)
            flag=1
            break
        elif s[i]==s[i+2]:
            print(i+1,i+3)
            flag=1
            break
    if flag==0:
        print("-1 -1")        

### FIXED CODE ###

s=input()
temp=0
tem=0
tot=0
flag=0
if s[-2]==s[-1]:
    print(len(s)-1,len(s))
else:
        
    if 1:
        for i in range(len(s)-2):
            if s[i]==s[i+1]:
                print(i+1,i+2)
                flag=1
                break
            elif s[i]==s[i+2]:
                print(i+1,i+3)
                flag=1
                break
        if flag==0:
            print("-1 -1")
stdin = [input() for i in range(3)]
line = stdin[0].split(' ')
A = int(line[0])
V = int(line[1])
line = stdin[1].split(' ')
B = int(line[0])
W = int(line[1])
T = int(stdin[2])
length = 0
if B < A:
    length = B-A
else:
    length = A-B
else:
    if (V-W)*T < length:
        print('NO')
    else:
        print('YES')

### FIXED CODE ###

stdin = [input() for i in range(3)]
line = stdin[0].split(' ')
A = int(line[0])
V = int(line[1])
line = stdin[1].split(' ')
B = int(line[0])
W = int(line[1])
T = int(stdin[2])
length = 0
if B > A:
    length = B-A
else:
    length = A-B
if (V-W)*T < length:
    print('NO')
else:
    print('YES')
#NとKに数値入る                                                                                                                   N,K = map(int, input().split())

#before_strに文字列
before_str = input()

str_list = list(before_str)
str_list[K-1] = str_list[K-1].swapcase()

after_str = ''.join(str_list)

print(after_str)

### FIXED CODE ###

N,K = map(int, input().split())
before_str = input()

str_list = list(before_str)
str_list[K-1] = str_list[K-1].swapcase()

after_str = ''.join(str_list)

print(after_str)
print("Yes" if (input() % 500) < input() else "No")

### FIXED CODE ###

print("Yes" if (int(input()) % 500) <= int(input()) else "No")
N,M = map(int,input().split())
tree = list(map(int,input().split())) #比較用
tree_sub = tree #データの削除用
for i in range(M):
    a,b = map(int,input().split())
    if (tree[a-1] > tree[b-1]) and (tree[b-1] in tree_sub):
        tree_sub.remove(b)
    elif (tree[a-1] < tree[b-1]) and (tree[b-1] in tree_sub):
        tree_sub.remove(a)
print(len(tree_sub))

### FIXED CODE ###

N,M = map(int,input().split())
tree = list(map(int,input().split())) #比較用
tree_sub = list(tree) #データの削除用
for i in range(M):
    a,b = map(int,input().split())
    if tree[a-1] > tree[b-1]:
        tree_sub[b-1] = 0
    elif tree[a-1] < tree[b-1]:
        tree_sub[a-1] = 0
    else:
        tree_sub[a-1] = 0
        tree_sub[b-1] = 0
print(len(tree_sub)-tree_sub.count(0))
S = input()
S = [Si for Si in S]

i = len(S) - 2
number_of_deleted_qube = 0
while i >= 0 and len(S) >= 2:
    current = S[i]
    right = S[i + 1]

    if current != right:
        del S[i + 1]
        del S[i]
        number_of_deleted_qube += 2

    i -= 1

print(number_of_deleted_qube)


### FIXED CODE ###

S = input()
S = [Si for Si in S]

i = len(S) - 2
number_of_deleted_qube = 0
while i >= 0 and len(S) >= 2:
    if i >= len(S) - 1:
        i -= 1
        continue

    current = S[i]
    right = S[i + 1]

    if current != right:
        del S[i + 1]
        del S[i]
        number_of_deleted_qube += 2

    i -= 1

print(number_of_deleted_qube)
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

# ある経路をきめる.
# そのとき(白マスから黒マスに移動する回数)＝(その経路がいい経路にするための操作回数）
dp = [[float("inf")]*w for _ in range(h)]
if s[0][0] == "#":
    dp[0][0] = 1
else:
    dp[0][0] = 0
# dp[i][j]は00からijに行くときに白マスから黒マスに移動する回数の最小値
for j in range(h):
    for i in range(w):
        if i+1 < w:
            count1 = dp[i][j]
            if s[i][j] == "." and s[i+1][j] == "#":
                count1 += 1
            dp[i+1][j] = min(dp[i+1][j], count1)
        if j+1 < h:
            count2 = dp[i][j]
            if s[i][j] == "." and s[i][j+1] == "#":
                count2 += 1
            dp[i][j+1] = min(dp[i][j+1], count2)
print(dp[w-1][h-1])


### FIXED CODE ###

h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]

# ある経路をきめる.
# そのとき(白マスから黒マスに移動する回数)＝(その経路がいい経路にするための操作回数）
dp = [[float("inf")]*w for _ in range(h)]
if s[0][0] == "#":
    dp[0][0] = 1
else:
    dp[0][0] = 0
# dp[i][j]は00からijに行くときに白マスから黒マスに移動する回数の最小値
for i in range(h):
    for j in range(w):
        if i+1 < h:
            count1 = dp[i][j]
            if s[i][j] == "." and s[i+1][j] == "#":
                count1 += 1
            dp[i+1][j] = min(dp[i+1][j], count1)
        if j+1 < w:
            count2 = dp[i][j]
            if s[i][j] == "." and s[i][j+1] == "#":
                count2 += 1
            dp[i][j+1] = min(dp[i][j+1], count2)
print(dp[h-1][w-1])
N = int(input())
p = N // 15
print(N*800 - P*200)

### FIXED CODE ###

N = int(input())
p = N // 15
print(N*800 - p*200)
import math
A = input()
B = input()
print(math.floor(A*B))

### FIXED CODE ###

def multiply(num1, num2): 
    len1 = len(num1) 
    len2 = len(num2) 
    if len1 == 0 or len2 == 0: 
        return "0"
  
    # will keep the result number in vector 
    # in reverse order 
    result = [0] * (len1 + len2) 
      
    # Below two indexes are used to  
    # find positions in result. 
    i_n1 = 0
    i_n2 = 0
  
    # Go from right to left in num1 
    for i in range(len1 - 1, -1, -1): 
        carry = 0
        n1 = ord(num1[i]) - 48
  
        # To shift position to left after every 
        # multiplication of a digit in num2 
        i_n2 = 0
  
        # Go from right to left in num2 
        for j in range(len2 - 1, -1, -1): 
              
            # Take current digit of second number 
            n2 = ord(num2[j]) - 48
          
            # Multiply with current digit of first number 
            # and add result to previously stored result 
            # at current position. 
            summ = n1 * n2 + result[i_n1 + i_n2] + carry 
  
            # Carry for next iteration 
            carry = summ // 10
  
            # Store result 
            result[i_n1 + i_n2] = summ % 10
  
            i_n2 += 1
  
            # store carry in next cell 
        if (carry > 0): 
            result[i_n1 + i_n2] += carry 
  
            # To shift position to left after every 
            # multiplication of a digit in num1. 
        i_n1 += 1
          
        # print(result) 
  
    # ignore '0's from the right 
    i = len(result) - 1
    while (i >= 0 and result[i] == 0): 
        i -= 1
  
    # If all were '0's - means either both or 
    # one of num1 or num2 were '0' 
    if (i == -1): 
        return "0"
  
    # generate the result string 
    s = "" 
    while (i >= 0): 
        s += chr(result[i] + 48) 
        i -= 1
  
    return s 
  
# Driver code 
str1, str2 = input().split()
str2 = str2.replace(".", "")
# print(str1)
# print(str2)
if((str1[0] == '-' or str2[0] == '-') and 
   (str1[0] != '-' or str2[0] != '-')): 
    print("-", end = '') 
  
  
if(str1[0] == '-' and str2[0] != '-'): 
    str1 = str1[1:] 
elif(str1[0] != '-' and str2[0] == '-'): 
    str2 = str2[1:] 
elif(str1[0] == '-' and str2[0] == '-'): 
    str1 = str1[1:] 
    str2 = str2[1:]
res = multiply(str1, str2)
if len(res)>2:
    print(multiply(str1, str2)[:-2]) 
else:
    print(0)
from math import gcd
x = input()
print(360*gcd(x,360)//x)

### FIXED CODE ###

from math import gcd
x = int(input())
print(360*(x//gcd(x,360))//x)
x,y = map(str,input().split())
a=np.count_nonzero([list(x)[i]==list(y)[i]  for i in range(len(list(x)))])
print(a)

### FIXED CODE ###

import numpy as np
hoge = []
for i in range(2):
    a = input()
    hoge.append(a)
a=np.count_nonzero([list(hoge[0])[i]==list(hoge[1])[i]  for i in range(3)])
print(a)
import sys
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

H, N = map(int, readline().split())
m = map(int, read().split())
AB = np.array(zip(m, m))

INF = 10**18

dp = [INF] * (H + 1)
dp[0] = 0
for a, b in AB:
    for n in range(H + 1):
        k = max(0, n - a)
        acc = dp[k] + b
        if acc < dp[n]:
            dp[n] = acc

print(dp[H])

### FIXED CODE ###

import sys
from bisect import bisect_left
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

H, N = map(int, readline().split())
m = map(int, read().split())
AB = zip(m, m)

INF = 10**18

dp = [INF] * (H + (10**4))
dp[0] = 0
for a, b in AB:
    for n in range(H):
        if dp[n + a] > dp[n] + b:
            dp[n + a] = dp[n] + b

print(min(dp[H:]))
from math import gcd
N,M = map(int,input().split())
S = input()
T = input()
k = gcd(N,M)
n = N//k
m = M//k
flg = False
for i in range(k):
    if S[n*i] != T[m*i]:
        flg = True
if flg:
    print(-1)
else:
    print(N*m)

### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

N,M = map(int,input().split())
S = input()
T = input()
k = gcd(N,M)
n = N//k
m = M//k
flg = False
for i in range(k):
    if S[n*i] != T[m*i]:
        flg = True
if flg:
    print(-1)
else:
    print(N*m)
cnt = 0
zorome = 0
num = input()

while cnt < num:
  mass = input().split()
  
  if(mass[0] == mass[1]):
    zorome += 1
    
    if(zorome >= 3):
      break
  
  cnt += 1

print("Yes" if zorome >= 3 else "No")

### FIXED CODE ###

cnt = 0
zorome = 0
num = int(input())

while cnt < num:
  mass = input().split()
  
  if(mass[0] == mass[1]):
    zorome += 1
    
    if(zorome >= 3):
      break
  else:
    zorome = 0
  
  cnt += 1

print("Yes" if zorome >= 3 else "No")
import itertools
import numpy as np
N = input(N)
digit = len(N)
ans = 0
if int(N) < 357:
    print(ans)
else:
    for i in range(3, len(N)):
        ans += 3**i - 3 * 2**i + 3
    for v in itertools.product('753', repeat=digit):
        if (len(set(list(v)))==3) & (int(''.join(list(v))) <= int(N)):
            ans +=1
    print(ans)

### FIXED CODE ###

import itertools
import numpy as np
N = input()
digit = len(N)
ans = 0
if int(N) < 357:
    print(ans)
else:
    for i in range(3, len(N)):
        ans += 3**i - 3 * 2**i + 3
    for v in itertools.product('753', repeat=digit):
        if (len(set(list(v)))==3) & (int(''.join(list(v))) <= int(N)):
            ans +=1
    print(ans)