Harryxun/stf_run huggingface dataset:
from collections import deque
h,w,k = map(int,input().split())
a,b,c,d=map(int,input().split())
a -= 1
b -= 1
c -= 1
d -= 1
maze = [input() for _ in range(h)]
dx = [1, -1, 0, 0]
dy = [0, 0 1, -1]
depth = [[float("inf") for _ in range(w)] for _ in range(h)]
dq = deque([b,a])
depth[a][b] = 0
while dq:
  x,y ==dq.popleft()
  if x == d and y == c:
    break
  for i in range(4):
    nx,ny,K = x,y,k
    while K:
      K -= 1
      nx += dx[i]
      ny += dy[i]
      if 0<=nx<=w-1 and 0<=ny<=h-1 and maze[nx][ny] != "@" and depth[nx][ny] > depth[y][x]:
        if depth[ny][nx] == depth[y][x]+1:
          continue
        depth[ny][nx] = depth[y][x] +1
        dq.append((nx,ny))
      else:
        break
print(depth[c][d] if depth[c][d] != float("inf") else -1)




### FIXED CODE ###

from collections import deque
h,w,k = map(int,input().split())
a,b,c,d = map(int,input().split())
a -= 1
b -= 1
c -= 1
d -= 1
maze = [input() for _ in range(h)]
dx = [1,-1,0,0]
dy = [0,0,1,-1]
depth = [[float("inf") for _ in range(w)] for _ in range(h)]
dq = deque([(b,a)])
depth[a][b] = 0
while dq:
    x,y = dq.popleft()
    if x == d and y == c:
        break
    for i in range(4):
        nx,ny,K = x,y,k
        while K:
            K -= 1
            nx += dx[i]
            ny += dy[i]
            if 0<=nx<=w-1 and 0<=ny<=h-1 and maze[ny][nx] != "@" and depth[ny][nx] > depth[y][x]:
                if depth[ny][nx] == depth[y][x]+1:
                    continue
                depth[ny][nx] = depth[y][x] +1
                dq.append((nx,ny))
            else:
                break
print(depth[c][d] if depth[c][d] != float("inf") else -1)
n,x=map(int,input().split())
l=list(map(int,input().split()))
a=0
for i in range(n):
  a+=l(i)
  if a>x:
    print(i+1)
    break

### FIXED CODE ###

n,x=map(int,input().split())
l=list(map(int,input().split()))
a=0
for i in range(n):
  a+=l[i]
  if a>x:
    print(i+1)
    break
else:
  print(1+n)
a = int(input())
b = int(input())

if (a*b) % == 0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

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

if (a*b) %2 == 0:
  print("Even")
else:
  print('Odd')
s=input()
t=input()
dp=[[-1]*(len(t)+1) for x in range(len(s)+1)]
arr = ""
def func(i,j):
    if i>=(len(s)) or j>=(len(t)):
        dp[i][j]=0
        return dp[i][j]
    if dp[i][j]!=-1:
        return dp[i][j]
    if s[i]==t[j]:
        dp[i][j] = func(i+1,j+1)+1
        return dp[i][j]
    dp[i][j] = max(func(i+1,j),func(i,j+1))
    return dp[i][j]
l=func(0,0)

i,j=0,0
while len(arr)<l:
    if s[i] == t[j]:
        arr=arr+s[i]
        i+=1
        j+=1
    else:
        if dp[i+1][j]>=dp[i][j+1]:
            i+=1
        else:
            j+=1
print(arr)


### FIXED CODE ###

s=input()
t=input()

dp=[[-1]*(len(t)+1) for x in range(len(s)+1)]
arr = ""
for i in range(len(s),-1,-1):
    for j in range(len(t),-1,-1):
        if i>=(len(s)) or j>=(len(t)):
            dp[i][j] = 0
        else:
            if s[i] == t[j]:
                dp[i][j] = dp[i+1][j+1] + 1
            else:
                dp[i][j] = max(dp[i+1][j],dp[i][j+1])

l=dp[0][0]
i,j=0,0
while len(arr)!=l:
    if s[i] == t[j]:
        arr=arr+s[i]
        i+=1
        j+=1
    else:
        if dp[i+1][j]>=dp[i][j+1]:
            i+=1
        else:
            j+=1

print(arr)



# def func(i,j):
    # if i>=(len(s)) or j>=(len(t)):
    #     return 0
    # if dp[i][j]!=-1:
    #     return dp[i][j]
    # if s[i]==t[j]:
    #     dp[i][j] = func(i+1,j+1)+1
    #     return dp[i][j]
    # if s[i]!=t[j]:
    #     dp[i][j] = max(func(i+1,j),func(i,j+1))
    #     return dp[i][j]
# l=func(0,0)
results=[]
while True:
    a=input().split("\"")
    if a[0]==".":
        break
    b=input().split("\"")
    count=0
    for i,j in zip(range(len(a)),range(len(b))):
        for k,l in zip(a[2*i+1],b[2*j+1]):
            if(k!=l):
                count+=1
    if count==0:
        results.append(0)
    elif count==1:
        results.append(1)
    else:
        results.append(2)
for i in results:
    if i==0:
        print("IDENTICAL")
    if i==1:
        print("CLOSE")
    if i==2:
        print("DIFFERENT")
    



### FIXED CODE ###

results=[]
while True:
    a=input().split("\"")
    if a[0]==".":
        break
    b=input().split("\"")
    count1=0
    count2=0
    if len(a) != len(b):
        results.append(2)
    else:
        for i in range(len(a)):
            if(i%2==1):
                if len(a[i]) != len(b[i]):
                    count1+=1
                else:
                    for k,l in zip(a[i],b[i]):
                        if(k!=l):
                            count1+=1
            else:
                if len(a[i]) != len(b[i]):
                    count2+=1
                else:
                    for k,l in zip(a[i],b[i]):
                        if(k!=l):
                            count2+=1           
        if count1==0 and count2==0:
            results.append(0)
        elif count1==1 and count2==0:
            results.append(1)
        else:
            results.append(2)
for i in results:
    if i==0:
        print("IDENTICAL")
    if i==1:
        print("CLOSE")
    if i==2:
        print("DIFFERENT")
n, x = (int(i) for i in input().split())  
l = list(int(_) for _ in input().split()) 
distance=0
_count=1
for i in range(0, n+1):
    distance += l[i]
    if distance<=x:
        _count += 1
    else:
        break
print(_count)

### FIXED CODE ###

x, a = (int(i) for i in input().split())  
if x<a:
    print(0)
else:
    print(10)
N,K=map(int,input().split())
V=list(map(int,input().split()))
if N<=K:
  W=sorted(V)
  h=sum(V)
  for i in range(K-N):
    a=W[i]
    if a<0:
      h-=a
    elif a>0:
      break
else:
  ans=[]
  for i in range(1,K):
    for j in range(i+1):
      l=V[0:i-j]+V[N-j:N]
      l.sort()
      H=sum(l)
      for k in range(min(i,K-i)):
        if l[k]<0:
          H-=l[k]
        elif l[k]>0:
          break
      ans.append(H)
  h=max(ans)
print(h)

### FIXED CODE ###

N,K=map(int,input().split())
V=list(map(int,input().split()))
if N<=K:
  W=sorted(V)
  h=sum(V)
  for i in range(K-N):
    if W[i]<0:
      h-=W[i]
    else:
      break
else:
  ans=[]
  for i in range(1,K+1):
    for j in range(i+1):
      l=V[0:i-j]+V[N-j:N]
      l.sort()
      H=sum(l)
      for k in range(min(i,K-i)):
        if l[k]<0:
          H-=l[k]
        else:
          break
      ans.append(H)
  h=max(ans)
print(h)
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A , B = tuple(list(map(int, input().split(' '))))
print(lcm(A, B))


### FIXED CODE ###


def gcd(x, y):
    m = max(x, y)
    n = min(x, y)
    if m % n == 0:
        return n
    else:
        return gcd(n, m%n)
def lcm(x, y):
    return (x * y) // gcd(x, y)

A , B = tuple(list(map(int, input().split(' '))))
if A == 1 or B == 1:
    print(max(A, B))
else:
    print(lcm(A, B))
import sys

def plus_and_check(list):
    sum_up = sum(list)
    return len(str(sum_up))

a = []
for line in sys.stdin:
    a.append(map(iny, raw_input().split()))

answer = []
for i in range(len(a)):
    answer = plus_and_check(a[i])

for i in range(len(answer)):
    print answer[i]

### FIXED CODE ###

import sys

a = []
answer_array = []
for line in sys.stdin:
    a.append(map(int, line.strip().split()))
    #except StopIteration:
        #break

for i in range(len(a)):
    sum_up = a[i][0] + a[i][1]

    answer = len(str(sum_up))

    answer_array.append(answer)

for j in range(len(answer_array)):
    print answer_array[j]
import sys
sys.setrecursionlimit(3000)

import numpy as np
N, T = [int(a) for a in input().split()]
time = np.full(N + 1, -1, dtype = np.int32)
value = np.full(N + 1, -1, dtype = np.int32)
for i in range(1, N + 1):
    time[i], value[i] = [int(a) for a in input().split()]

# Sort the array in the increasing order of value
time = time[np.argsort(value)]
value.sort()

# table for knapsack problem
# maximum possible time is T-1
dp_table = np.full((N + 1, T + 1), -1, dtype = np.int32)

def knapsack(n, t):
    '''
    Input: n ... the number of elements to choose from
                 n means items 1, 2, ..., n can be chosen
           t ... time limit
    Output: total value
    '''
    if n <= 0 or t <= 0:
        return 0
    elif dp_table[n, t] >= 0:
        return dp_table[n, t]
    elif time[n] > t:
        ans = knapsack(n-1, t)
    else:
        ans = max(knapsack(n-1, t), value[n] + knapsack(n-1, t - time[n]))

    dp_table[n, t] = ans
    return ans

def all_you_can_eat(n, t):
    if n <= 0 or t <= 0:
        return 0
    else:
        # Eat the most delicious food at the beginning
        tmp1 = value[n] + all_you_can_eat(n - 1, t - time[n])
        # Eat the most delicious food at the end
        tmp2 = value[n] + knapsack(n - 1, t - 1)
        return max(tmp1, tmp2)

print(all_you_can_eat(N, T))


### FIXED CODE ###

import sys
from operator import itemgetter

sys.setrecursionlimit(5000)
input = sys.stdin.readline


TIME = 0
VAL = 1

N, T = [int(a) for a in input().split()]
time_value = [None] * (N + 1)
time_value[0] = (-1, -1)
for i in range(1, N + 1):
    time_value[i] = tuple(int(a) for a in input().split())

# Sort the array in the increasing order of value
time_value.sort(key = itemgetter(VAL))


# T by (N + 1) table for knapsack problem
# maximum possible time is T-1
dp_table = [[-1] * T for _ in range(N + 1)]

# Fill in dp_table i.e. solve knapsack problem
for t in range(0, T):
    dp_table[0][t] = 0

for n in range(1, N + 1):
    dp_table[n][0] = 0
    for t in range(1, T):
        if time_value[n][TIME] > t:
            dp_table[n][t] = dp_table[n - 1][t]
        else:
            dp_table[n][t] = max(dp_table[n - 1][t],
                             time_value[n][VAL] + dp_table[n - 1][t - time_value[n][TIME]])


val_acum = time_value[N][VAL]
t = T - 1
max_val = val_acum + dp_table[N - 1][t]

for n in range(N - 1, 0, -1):  # food to eat at the end
    val_acum += time_value[n][VAL] # value[N] + value[N-1] + ... + value[n]
    t -= time_value[n + 1][TIME] # T - 1 - (time[N] + time[N-1] + ... + time[n + 1])
    if t < 0: break
    tmp = val_acum + dp_table[n - 1][t]
    max_val = max(max_val, tmp)

print(max_val)
N= int(input())
if N%9==0:
  print('Yes')
  
  else :
    print('No')

### FIXED CODE ###

N=int(input())
print('Yes' if N%9==0 else 'No')
n, a, b = map(int, input().split())
 
ans = 0
 
for x in range(n+1):
    y = str(x)
    z = list(map(int, y))
    sum_x = sum(z)
    
    if a <= sum_x and sum_x <= b:
        ans += x

print(ans)

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0

for i in range(0,a+1):
    for j in range(0,b+1):
        for k in range(0,c+1):
            if 500*i + 100*j + 50*k == x:
                count += 1

print(count)
n=int(input())
s=input()
ans=[]
for i in range(1,n-1):
    ans.append(len(set((s[:i]))&(set(s[i:]))))
print(max(ans))

### FIXED CODE ###

n=int(input())
s=input()
ans=[]
for i in range(n):
    ans.append(len(set((s[:i]))&(set(s[i:]))))
print(max(ans))
def main():
    height, width = map(int, input().split(" "))
    grids = ["." * (width + 2)]
    for _ in range(height):
        grids.append("." + input() + ".")
    grids.append("." * (width + 2))
    is_possible = True
    for i in range(1, width + 1):
        for j in range(1, height + 1):
            if grids[i][j] == "#":
                if not (grids[i + 1][j] == "#" or grids[i - 1][j] == "#" or grids[i][j + 1] == "#" or grids[i][j - 1] == "#"):
                    is_possible = False
    if is_possible:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    height, width = map(int, input().split(" "))
    grids = ["." * (width + 2)]
    for _ in range(height):
        grids.append("." + input() + ".")
    grids.append("." * (width + 2))
    is_possible = True
    for i in range(1, height + 1):
        for j in range(1, width + 1):
            if grids[i][j] == "#":
                if not (grids[i + 1][j] == "#" or grids[i - 1][j] == "#" or grids[i][j + 1] == "#" or grids[i][j - 1] == "#"):
                    is_possible = False
    if is_possible:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
a=int(input().split())
b=int(input().split())

if a>b:
  print('GREATER')
elif a==b:
  print('EQUAL')
else:
  print('LESS')

### FIXED CODE ###

a=int(input())
b=int(input())

if a>b:
  print('GREATER')
elif a==b:
  print('EQUAL')
else:
  print('LESS')
from sys import stdin
S = (stdin.readline().rstrip())
flag = False
for i in ["","A"]:
    for j in ["","A"]:
        for k in ["","A"]:
            for l in ["","A"]:
                s = i + KIH + j + B + k + R + l
                if S == s:
                    flag = True
if flag:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

from sys import stdin
S = (stdin.readline().rstrip())
flag = False
for i in ["","A"]:
    for j in ["","A"]:
        for k in ["","A"]:
            for l in ["","A"]:
                s = i + "KIH" + j + "B" + k + "R" + l
                if S == s:
                    flag = True
if flag:
    print("YES")
else:
    print("NO")
N = int(input())
K = int(input())
dp = [0] * (N+10)
dp[0] = 1
for i in range(1, N):
  dp[i] = min(d[i-1] * 2, d[i-1] + K)
print(dp[N-1])

### FIXED CODE ###

N = int(input())
K = int(input())
dp = [0] * (N+10)
dp[0] = 1
for i in range(1, N+1):
  dp[i] = min(dp[i-1] * 2, dp[i-1] + K)
print(dp[N])
import re
s=input()

def hoge(str)
    res = []
	if(str.startWith("dream")):
		res.append(re.sub('^dream', '', str))
	if(str.startWith("dreamer")):
		res.append(re.sub('^dreamer', '', str))
	if(str.startWith("erase")):
		res.append(re.sub('^erase', '', str))
	if(str.startWith("eraser")):
		res.append(re.sub('^eraser', '', str))
	return res

def fuga(res):
	if(len(res) == 0):
  		return "NO"
	if("" in res):
  		return "YES"
	for str in res:
        return fuga(hoge(str))
print(fuga([s])

### FIXED CODE ###

def main():
    S = input()

    while len(S) >= 5:
        if len(S) >= 7 and S[-7:] == "dreamer":
            S = S[:-7]
            continue

        if len(S) >= 6 and S[-6:] == "eraser":
            S = S[:-6]
            continue

        elif S[-5:] == "dream" or S[-5:] == "erase":
            S = S[:-5]
            continue

        else:
            break

    if len(S) == 0:
        print("YES")
    else:
        print("NO")

main()
#coding:utf-8

A, B = map(int,raw_input().split())
S = raw_input()

if S[A] != '-':
    print "No"

elif (A != 0) and (S[0:A] in "-"):
    print "No"

elif (B != 0) and (S[A+1:len(S)] in "-"):
    print "No"

else:
    print "Yes"


### FIXED CODE ###

#coding:utf-8

now = int(raw_input())

time = 48 - now

print time
a=input()
b=input()
print a*b,a*2+b*2

### FIXED CODE ###

a,b=map(int,raw_input().split())
print a*b,a*2+b*2
import sys
from collections import deque
H, W = map(int, input().split())
gridgraph = []
for line in sys.stdin.readlines():
    line = line.rstrip()
    gridgraph.append(list(line))

q = deque()
visited = [[False]*W for _ in range(H)]
ans = [[1e+9]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if gridgraph[i][j] == "#":
            q.append((i, j))
            visited[i][j] = True
            ans[i][j] = 0
# for a, b in q:
#     print(a, b)
# exit()
while len(q):
    cy, cx = q.popleft()
    # print(cy, cx)
    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        if not (cy+dy >= 0 and H-1 >= cy+dy and cx+dx >= 0 and W-1 >= cx+dx):
            continue
        if visited[cy+dy][cx+dx]:
            continue
        visited[cy+dy][cx+dx] = True
        ans[cy+dy][cx+dx] = min(ans[cy+dy][cx+dx], ans[cy][cx]+1)
        q.put((cy+dy, cx+dx))
    # print(ans)
    # exit()

min_value = 0
for a in ans:
    min_value = max(min_value, max(a))
print(min_value)


### FIXED CODE ###

import sys
from collections import deque
H, W = map(int, input().split())
gridgraph = []
for line in sys.stdin.readlines():
    line = line.rstrip()
    gridgraph.append(list(line))
q = deque()
visited = [[False]*W for _ in range(H)]
ans = [[1e+9]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if gridgraph[i][j] == "#":
            q.append((i, j))
            visited[i][j] = True
            ans[i][j] = 0

while len(q):
    cy, cx = q.popleft()

    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        if not (cy+dy >= 0 and H-1 >= cy+dy and cx+dx >= 0 and W-1 >= cx+dx):
            continue
        if visited[cy+dy][cx+dx]:
            continue
        visited[cy+dy][cx+dx] = True
        ans[cy+dy][cx+dx] = min(ans[cy+dy][cx+dx], ans[cy][cx]+1)
        q.append((cy+dy, cx+dx))

min_value = 0
for a in ans:
    min_value = max(min_value, max(a))
print(min_value)
n=input()
#print(n)
data=['','+']
x=['0']*10000
#print(x)
for i8 in range(2):
  for i7 in range(2): 
    for i6 in range(2): 
      for i5 in range(2): 
        for i4 in range(2): 
          for i3 in range(2): 
            for i2 in range(2): 
              for i1 in range(2): 
                for i0 in range(2):
                  x[i0+2*i1+4*i2+8*i3+16*i4+32*i5+64*i6+128*i7+256*i8]=(n[0]+data[i0]+n[1]
                         +data[i1]+n[2]
                         +data[i2]+n[3]
                         +data[i3]+n[4]
                         +data[i4]+n[5]
                         +data[i5]+n[6]
                         +data[i6]+n[7]
                         +data[i7]+n[8]
                         +data[i8]+n[9])        
        
x=[eval(i) for i in x]

print(sum(x))
#12656242944

### FIXED CODE ###

n=input()
size=len(n)
#print(n,size)

ans=0
for i in range(2**(size-1)):
    z=format(i,'b').zfill(size-1)
#    print(z)
    string=n[0]
    for j in range(size-1):
        if z[j]=='1':
            string+='0'+n[j+1]
        elif z[j]=='0':
            string+=n[j+1]
    string=string.replace('0','+')
    ans+=eval(string)

print(ans)

#12656242944
N,M = map(int,input().split())
a = [0]*N
b = [None]*N
for i in range(M):
  s,c = map(int,input().split())
  if b[s-1] == c:
    continue
  else:
    a[s-1] +=1
    b[s-1] =c
    
count = 0
for i in range(N):
  if a[i]>=2:
    count=-1
  elif b[0]==0 and N>1:
    count =-1
  elif b[i]==0:
    if i is None:
      if N==1:
        b[i] =0
      else:
        b[i]=1
  elif i>0:
    if b[i] is None:
      b[i]=0
b.reverse()
if count == 0:
  for i in range(N):
    count+=b[i]*10**i
print(count)
    

### FIXED CODE ###

N,M = map(int,input().split())
a = [0]*N
b = [None]*N
for i in range(M):
  s,c = map(int,input().split())
  if b[s-1] == c:
    continue
  else:
    a[s-1] +=1
    b[s-1] =c
    
count = 0
for i in range(N):
  if a[i]>=2:
    count=-1
  elif b[0]==0 and N>1:
    count =-1
  elif i==0:
    if b[i] is None:
      if N==1:
        b[i] =0
      else:
        b[i]=1
  elif i>0:
    if b[i] is None:
      b[i]=0
b.reverse()
if count == 0:
  for i in range(N):
    count+=b[i]*10**i
print(count)
#!/usr/bin/env python
# coding: utf-8

def no():
    print("No")
    return

def shift(i):
    return i+8001

def main():
    s = input()
    x, y = list(map(int, input().split()))
    x_start = 0
    x_count = 0
    y_count = 0
    t_count = 0
    f_count = 0
    x_dirs = []
    y_dirs = []
    is_x = True # xを向いてるか
    f_before_t = 0
    t_exist = False
    for c in s:
        if c == "T":
            t_count += 1
            if f_count > 0:
                if is_x and not t_exist:
                    x_dirs.append(f_count)
                else:
                    y_dirs.append(f_count)
                f_count = 0
            t_exist = True
            continue
        f_count += 1
        if not t_exist:
            x_start += 1
            f_before_t += 1
        if t_count % 2 == 0:
            # 向いている方向に進む
            if is_x:
                x_count += 1
            else:
                y_count += 1
        else:
            if is_x:
                y_count += 1
            else:
                x_count += 1
            is_x = not is_x
        t_count = 0
    if f_count > 0:
        if is_x:
            x_dirs.append(f_count)
        else:
            y_dirs.append(f_count)
    if (x % 2) != (x_count % 2):
        return no()
    if abs(x) > x_count:
        return no()
    if (y % 2) != (y_count % 2):
        return no()
    if abs(y) > y_count:
        return no()
    if (x_count - f_before_t*2) < x*-1:
        return no()


    memo_x = [[False for _ in range(16001)] for _ in range(len(x_dirs)+1)]
    memo_y = [[False for _ in range(16001)] for _ in range(len(y_dirs)+1)]
    memo_x[0][shift(x_start)] = True
    memo_y[0][0] = True

    for i, dx in enumerate(x_dirs):
        for j in range(16001):
            if memo_x[i][j]:
                memo_x[i+1][j-dx] = True
                memo_x[i+1][j+dx] = True
    for i, dy in enumerate(y_dirs):
        for j in range(16001):
            if memo_y[i][j]:
                memo_y[i+1][j-dy] = True
                memo_y[i+1][j+dy] = True
    if not memo_x[len(x_dirs)][shift(x)]:
        return no()
    if not memo_y[len(y_dirs)][shift(y)]:
        return no()
    print("Yes")


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8


def main():
    a, b = list(map(int, input().split()))
    x = (a+b+1)//2
    print(x)


if __name__ == '__main__':
    main()
a,b,c,d = map(int,input().split())

aoki_new = (a+d-1)/d
taka_new1 = (a+b-1)/b

if taka_new1 <= aoki_new :
	print("Yes") #takahasi is loses because its heath is zero first
else:
	print("No")






### FIXED CODE ###

s,w = map(int,input().split())

if s<w or s==w:
	print("unsafe")
else:
	print("safe")
from math import gcd

a, b = map(int, input().split())
print(a * b // gcd(a, b))

### FIXED CODE ###

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

a, b = map(int, input().split())
print(a * b // gcd(a, b))
A,B,H,M=map(int, input().split())

angle = abs(30*H-5.5*M)
angle = min(angle, 360-angle)*math.pi/180

c=A**2 + B**2 -2*A*B* math.cos(angle)
c=c**0.5

print(c)

### FIXED CODE ###

A,B,H,M=map(int, input().split())
import math

angle = abs(30*H-5.5*M)
angle = min(angle, 360-angle)*math.pi/180
 
c=A**2 + B**2 -2*A*B* math.cos(angle)
c=c**0.5
 
print(c)
s = input()
if s == "SSS":
    print(0)
if s == 'SSR' or s == 'SRS' or s == 'RSS'or s == 'RSR':
    print(1)
if s == 'RRS'or s == 'SRR':
    print(2)
if s == 'RRR' print(3)


### FIXED CODE ###

s = input()
if s == "SSS":
    print(0)
if s == 'SSR' or s == 'SRS' or s == 'RSS'or s == 'RSR':
    print(1)
if s == 'RRS'or s == 'SRR':
    print(2)
if s == 'RRR':
    print(3)
s = input()

def solve(s):
    i = 0
    n = len(s)

    while i < n:
        if s[i:i+5] == 'dream':
            if s[i+5:i+7] != 'er':
                i += 5
            elif i+7 < n and s[i+7] == 'a':
                i += 5
            else:
                i += 7
        elif s[i:i+5] == 'erase':
            if s[i+5] == 'r':
                i += 6
            else:
                i += 5
        else:
            return False
    return True

if solve(s):
    print("Yes")
else:
    print('No')


### FIXED CODE ###

s = input()

def solve(s):
    i = 0
    n = len(s)

    while i < n:
        if s[i:i+5] == 'dream':
            if s[i+5:i+7] != 'er':
                i += 5
            elif i+7 < n and s[i+7] == 'a':
                i += 5
            else:
                i += 7
        elif s[i:i+5] == 'erase':
            if i+5 < n and s[i+5] == 'r':
                i += 6
            else:
                i += 5
        else:
            return False
    return True

if solve(s):
    print("YES")
else:
    print('NO')
n, m, L = map(int, input().split())
 
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
c = [[sum(ak * bk for ak, bk in zip(ai,bj)) for bj in zip(*b)] for ai in a]
 
for ci in c:
    print(*ci)

### FIXED CODE ###

n, m, L = map(int, input().split())
 
a = [list(map(int, input().split())) for _ in range(n)]
b = [list(map(int, input().split())) for _ in range(m)]
c = [[sum(ak * bk for ak, bk in zip(ai,bj)) for bj in zip(*b)] for ai in a]
 
for ci in c:
    print(*ci)