Harryxun/stf_run huggingface dataset:
A = int(input())
B = int(input())
H = int(input())
M = int(input())

import math

time = H*60 + M
dist = (5.5 * time)%360
if 0 < dist < 180:
   dist = 360 - dist

ans = math.sqrt(A*A + B*B  - 2*A*B*math.cos(math.radians(dist)))

print(ans)

### FIXED CODE ###

A,B,H,M=(int(x) for x in input().split())

import math

time = H*60 + M
dist = (5.5 * time)%360
if 0 < dist < 180:
   dist = 360 - dist

ans = math.sqrt(A*A + B*B  - 2*A*B*math.cos(math.radians(dist)))

print(ans)
N,K=map(int,input().split())
 
while K <= N:
  N = N // K
  a +=a
 
print(a)

### FIXED CODE ###

N,K=map(int,input().split())
a = 1
while K <= N:
  N = N // K
  a =a+1
  
print(a)
n = int(input()))
for i in range(n):
    M = [0] * n
    u = list(map(int, input().split()))
    v = u[0]
    for j in u[2:]:
        M[u - 1][v - 1] = 1

for i in M:
    print(*i)

### FIXED CODE ###

n = int(input())
M = [[0] * n for i in range (n)]
for i in range(n):
    u = list(map(int, input().split()))
    v = u[0]
    for j in u[2:]:
        M[v - 1][j - 1] = 1

for i in M:
    print(*i)
x = input().split()
x = x[0], x[2], x[1]
print("yes" all(map(lambda x, y: x==y, x, sorted(x))) else "No")

### FIXED CODE ###

import sys
import math
N = list(map(int, input().split()))

t = False
if (N[0] < N[1]) == (N[0] < N[2]):
    if abs(N[1] - N[0]) > abs(N[2] - N[0]):
        t = True

print("Yes" if t else "No")
N, X, T = map(int, input().split())

a = N // X
if N%X == 0
	min_T=T*a
else
	min_T = T*(a+1)

print(min_T)

### FIXED CODE ###

N, X, T = map(int, input().split())

a = N // X
if N%X == 0:
	min_T=T*a
else:
	min_T = T*(a+1)

print(min_T)
a,b,c=map(int,input().split())
ans=[0]*b
if c>b-2:
    for i in range(b):
        d=(i+1)*b-1
        ans[i]=int((a*d)/b)-d*(int(d/b))
        print(ans[i])
        if c<=d:
            break
        if i==1000000:
            break
else :
    ans[0]=int((a*c)/b)-b*(int(c/b))
print(max(ans))

### FIXED CODE ###


import math
 
def f(A, B, X):
	return math.floor((A*X)/B) - A*math.floor(X/B)
 
A,B,N = map(int,input().split())
 
if N < B:
	print(f(A,B,N))
else:
	print(f(A,B,B-1))
N, A, B = map(int, input().split())
x = N * A
y = B

li = [x,y]
print(min(li()))

### FIXED CODE ###

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

x = N*A
y = B

li = [x,y]
print(min(li))
str1 = list(input())
str2 = list(input())
count = 0
for i in range(len(str1)):
  if str1[i] != str2[i]:
    count +=1
print(count)

### FIXED CODE ###

num = int(input())
print(int(num + num**2 + num**3))
x, a = = (int(i) for i in input().split())
def function(x, a):
  if x < a:
    return 0
  else:
    return 10
  
function(x,a)

### FIXED CODE ###

x, a = (int(i) for i in input().split())
def function(x, a):
  if x < a:
    return 0
  else:
    return 10
  
print(function(x,a))
A-2B

### FIXED CODE ###

A,B=input().split()
length = int(A) - 2 * int(B)
if length < 0:
    print(0)
else:
    print(length)
a

### FIXED CODE ###

S,W=input().split()
if int(S)<=int(W):
    print("unsafe")
else:
    print("safe")
# -*- coding: utf-8 -*-
import math
def main():
    A,B,C,D = map(int,input().split())
    E = math.gcd(C*D)
    Cc = B / C
    Dd = B / D
    Ee = B / E
    flo = A-1
    Cf = flo / C
    Df = flo / D
    Ef = flo / E
    All = B-(math.floor(Cc)+math.floor(Dd)-math.floor(Ee))
    Sub = flo-(math.floor(Cf)+math.floor(Df)-math.floor(Ef))
    print(All - Sub)
if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding: utf-8 -*-
import fractions
def lcm(x, y):
    return (x*y) // fractions.gcd(x, y)
def main():
    A,B,C,D = map(int,input().split())
    E = lcm(C,D)
    Cc = B // C
    Dd = B // D
    Ee = B // E
    flo = A-1
    Cf = flo // C
    Df = flo // D
    Ef = flo // E
    All = B-(Cc+Dd-Ee)
    Sub = flo-(Cf+Df-Ef)
    print(int(All - Sub))
if __name__ == '__main__':
    main()
W, H, x, y = map(int, input().split())
S = max(min(x*H, (W-x)*H), min(W*y, W*(H-y)))
cond = 1 if W/H==x/y else 0
    
print(S, cond)

### FIXED CODE ###

W, H, x, y = map(int, input().split())
S = W*H*0.5
cond = 1 if (W/2==x)&(H/2==y) else 0
print(S, cond)
a, b, c = [int(i) for i in input().split()]
nums = 0
for i in range(a,c+1)
    if b%i ==0 :
        nums = nums + 1
    else:
        pass
   
print(nums)

### FIXED CODE ###

a, b, c = [int(i) for i in input().split()]
nums = 0
for i in range(a, b + 1):
    if c%i == 0:
        nums = nums + 1
    else:
        pass
print(nums)
from collections import Counter
from operator import itemgetter

N = int(input())
V = Counter(map(int, input().split()))

C = list(V.items())
C = sorted(C,key=itemgetter(1),reverse = True)
#print(C)

even = []
odd = []
for i in range(min(len(C),100)):
    if C[i][0] % 2 ==0:
        even.append(C[i])
    else:
        odd.append(C[i])
cnt = 0
if even[0][1] != odd[0][1]:
    for i in range(1,len(odd)):
        cnt += even[i][1]
    for i in range(1,len(even)):
        cnt += odd[i][1]
print(cnt)

### FIXED CODE ###

from collections import Counter

n = int(input())
v = list(map(int,input().split()))
ac = Counter(v[::2]).most_common(2)
bc = Counter(v[1::2]).most_common(2)



if ac[0][0] != bc[0][0]:            #奇数列と偶数列の最頻数が同じ要素でない場合
    ans =  n - ac[0][1] - bc[0][1]  #全体の数から書き換える必要がない数（それぞれの最頻値）を引けばよい
else:                               #奇数列と偶数列の最頻数が同じ要素の数の場合
    if len(bc) == 1 or len(ac) == 1:#全部同じ数の場合 
        ans = n // 2
    else: #２番目の最頻数を比較し、大きいほうの列の最も多大きい最頻数ともう一方の列の2番目に大きい最頻数を書き換える
        ans = n - max(ac[0][1] + bc[1][1], ac[1][1] + bc[0][1])
print(ans)
#問題D
M,N = list(map(int,input().split())) 
ROW = list(map(int,input().split())) 
COL = list(map(int,input().split())) 
#M= 3
#N= 3 
#ROW = [8,9,7]
#COL = [6,9,8]
#N,M = 14,13
#ROW = [158, 167, 181, 147, 178, 151, 179, 182, 176, 169, #180, 129, 175, 168]
#COL = [181, 150, 178, 179, 167, 180, 176, 169, 182, 177, #175, 159, 173]
import numpy as np
row = 0
col = 0
nums = np.arange(1,M*N+1)[::-1]
pattern = np.zeros(M*N)
ans = 1
#print(nums)
for i in nums:
    if i in ROW and i in COL:
        row += 1
        col += 1
#        pattern[i-1] = 1
    elif i in ROW and i not in COL:
        row += 1
#        pattern[i-1] = col
        ans *= col
    elif i not in ROW and i in COL:
        col += 1
#        pattern[i-1] = row
        ans *= row

    elif i not in ROW and i not in COL:
#        pattern[i-1] = row * col - (M*N-i)
        ans *= (row * col - (M*N-i))
       
        if row * col - (M*N-i) <= 0:
            ans = 0
            break
    ans %= (10**9+7)
#    print(i,row,col,pattern[i-1])
#print(pattern)
#ans = int(pattern.prod())
#ans = ans % (10**9+7)
print(ans)

### FIXED CODE ###

nums = list(map(int,input().split()))
flag1 = 1 in nums and 9 in nums and 7 in nums and 4 in nums
if flag1 == True:
    print("YES")
else:
    print("NO")
N = input()
for i in range(3):
  if N[i] == '1':
    N[i] = '9'
  else:
    N[i] = '1'
 
print(N)

### FIXED CODE ###

N = input()
print(N.translate(str.maketrans({'1': '9', '9': '1'})))
n,m=map(int,input().split())
if n==M:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n,m=map(int,input().split())
if n==m:
    print("Yes")
else:
    print("No")
a, b, m = input().split()
a, b, m = int(a), int(b), int(m)
a_values = input().split()
b_values = input().split()
m_values = {}
for i in range(m):
  m[i] = input().split()

min = int(a_values[m[0][0]]) + int(b_values[m[0][1]]) - int(m[0][2])
for i in range(1, m):
  now = int(a_values[m[i][0]]) + int(b_values[m[i][1]]) - int(m[i][2])
  if min > now:
    min = now
print(min)

### FIXED CODE ###

a, b, m = input().split()
a, b, m = int(a), int(b), int(m)
a_values = input().split()
b_values = input().split()
m_values = {}
for i in range(m):
    m_values[i] = input().split()

min_num = int(a_values[int(m_values[0][0]) - 1]) + int(b_values[int(m_values[0][1]) - 1]) - int(m_values[0][2])
for i in range(1, m):
    now = int(a_values[int(m_values[i][0]) - 1]) + int(b_values[int(m_values[i][1]) - 1]) - int(m_values[i][2])
    if min_num > now:
        min_num = now
now = int(min(a_values)) + int(min(b_values))
if min_num > now:
    print(now)
else:
    print(min_num)
import math
import collections

from operator import mul
from functools import reduce

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

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

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(M))
#print(c)
ans = 1
for i,j in c.items():
    ans *= cmb(N+j-1,j,mod)
print(int(ans%mod))

### FIXED CODE ###

import math
import collections

from operator import mul
from functools import reduce

n,m = list(map(int,input().split()))

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 100 + n
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(m))
#print(c)
ans = 1
for i,j in c.items():
    ans *= cmb(n+j-1,j,mod) % mod
print(int(ans%mod))
from heapq import heappush, heappop
N, K , *P = map(int, open('0').read().split())
mhq = []
Mhq = []
for c in P[:K]:
  heappush(mhq,c)
  heappush(Mhq,-c)

ans = 1
log = set()
for i,c in enumerate(P[K:]):
  while mhq[0] in log:
    heappop(mhq)
  while -Mhq[0] in log:
    heappop(Mhq)
  d = P[i]
  m = mhq[0]
  M = -Mhq[0]
  log.add(d)
  heappush(mhq,c)
  heappush(Mhq,-c)
  if not (m==d and M<c):
    ans += 1
p = P[0]
m = 1
x = 0
for c in P[1:]:
  if p<c:
    m += 1
  else:
    if m>=K:
      x += 1
    m = 1
  p = c
if m>=K:
  x += 1
if x!=0:
  ans -= x-1
print(ans)

### FIXED CODE ###

from heapq import heappush, heappop
N, K , *P = map(int, open(0).read().split())
mhq = []
Mhq = []
for c in P[:K]:
  heappush(mhq,c)
  heappush(Mhq,-c)

ans = 1
log = set()
for i,c in enumerate(P[K:]):
  while mhq[0] in log:
    heappop(mhq)
  while -Mhq[0] in log:
    heappop(Mhq)
  d = P[i]
  m = mhq[0]
  M = -Mhq[0]
  log.add(d)
  heappush(mhq,c)
  heappush(Mhq,-c)
  if not (m==d and M<c):
    ans += 1
p = P[0]
m = 1
x = 0
for c in P[1:]:
  if p<c:
    m += 1
  else:
    if m>=K:
      x += 1
    m = 1
  p = c
if m>=K:
  x += 1
if x!=0:
  ans -= x-1
print(ans)
c1=input()
c2=input()
if c1[0]==c2[2],c1[1]==c2[1],c1[2]==c2[0]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

c1=input()
c2=input()
if c1[0]==c2[2] and c1[1]==c2[1] and c1[2]==c2[0]:
  print('YES')
else:
  print('NO')
from math import factorial
N=int(input())
K=int(input())
#N,K = int(314159),int(3)
S = list(map(int,str(N)))

def C(n,r): 
    return factorial(n) // (factorial(n - r) * factorial(r))

def D(i,j): 
    return (9**j)*C(i,j)

ans = 0
l = len(S)
for i in range(l):
    if K >= 1:
        print('K',K)
        print((int(S[i])-1)*D(l-1,K-1))
        print(D(l-1,K))
        ans = ans + (int(S[i])-1)*D(l-1,K-1) + D(l-1,K)
        K -= 1
        l -= 1
    else:
        ans += 1
        break
print(ans)


### FIXED CODE ###

from math import factorial
N = int(input())
K = int(input())
S = list(map(int,str(N))) #桁数
ans = 0
digit = len(S)
k = K

def D(i,j): 
    if i >= j:
        return (9**j) * (factorial(i) // (factorial(i - j) * factorial(j)))
    else:
        return 0

if K > len(S):
    print(0)
    exit()

for i in range(digit):
    digit -= 1
    if int(S[i]) == 0:
        if K == len(S):
            print(0)
            exit()
        continue
    ans += D(digit,k)
    k -= 1
    if k == 0:
        ans += S[i]
        break
    ans += (int(S[i]-1))*D(digit,k)
print(ans)
import sys
sys.setrecursionlimit(80000)

n=int(input())
visitedlist=[-1 for  i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]
for i in range(n-1):
        a,b,c=map(int,input().split())
        kilist[a-1].append((b,c))
        kilist[b-1].append((a,c))
def search(i):
        searchedlist[i-1]=1
        visitedlist[i-1]=1
        flag=0
        for j in kilist[i-1]:
            if visitedlist[j[0]-1]<0:
                visitedlist[j[0]-1]=1
                flag+=1
                anslist[j[0]-1]=anslist[i-1]+j[1]
        else:
            pass

        if flag>0:    
            for k in kilist[i-1]:
                if searchedlist[k[0]-1]==-1:
                    search(k[0])
search(2)
for i in anslist:
    print(i%2)


### FIXED CODE ###

n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
print("".join(s))
a, b, x= raw_input().split()
m = (b-a)//x
if a%x == 0 or b%x == 0:
    print m+1
else:
    print m

### FIXED CODE ###

a, b, x= map(int, raw_input().split())
if a%x == 0:
    print b//x - a//x +1
else:
    print  b//x - a//x
s=str(input())
s=list(s)
t=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
if len(s)!=26:
  for i in range(26):
    if t[i] not in s:
      s.append(t[i])
      break
  print("".join(s))
else:
  if "".join(s)=="abcdefghijklmnopqrstuvwxyz":
    print("abcdefghijklmnopqrstuvwxzy")
  elif "".join(s)=="zyxwvutsrqponmlkjihgfedcba":
    print(-1)
  else:
    ans=[]
    for i in range(26):
      if s[i]==t[i]:
        ans.append(s[i])
      else:
        if len(ans)==1:
          ans.append(t[i])
        else:
          del ans[len(ans)-1]
          ans.append(t[i])
          break
    print("".join(ans))

### FIXED CODE ###

s=str(input())
t=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
if len(s)!=26:
  s=list(s)
  for i in range(26):
    if t[i] not in s:
      s.append(t[i])
      break
  print("".join(s))
else:
  if "".join(s)=="zyxwvutsrqponmlkjihgfedcba":
    print(-1)
  else:
    a=[]
    for i in range(26):
      a.append(s[25-i])
      for j in a:
        if s<s[:25-i]+j:
          print(s[:25-i]+j)
          exit()
#
# N M
# S
# T
#
# find X (length L, LはN, Mで割り切れる (最小公倍数))
#
# e.g.
# 3 2
# acp
# ae
#
# X
# - 
# - 1, L/N+1, 2L/N+1, ... はSになる
# - 1, L/M+1, 2L/M+1, ... はTになる

from fractions import gcd

N, M = map(int, input().split())
S = input()
T = input()
L = N * M // gcd(N, M)

if S[0] != T[0]:
    print(-1)
    exit()

# 仮の文字列 (中身は何でもいい)
ans = [S[0]] + ["-"] * (L - 1)

# Sを置く
for i in range(N):
    ans[i * L // N] = S[i]

# print(ans)

# Tを置く
# 既にSが入っている場合，Tと整合するか確認する
for i in range(M):
    index = i * L // M
    if ans[index] != "-":
        if ans[index] != T[i]:
            print(-1)
            exit()
        else:
            ans[index] = T[i]
    else:
        ans[index] = T[i]


print(L)

### FIXED CODE ###

from fractions import gcd

N, M = map(int, input().split())
S = input()
T = input()

lcm = N * M // gcd(N, M)
n = N // gcd(N, M)
m = M // gcd(N, M)

for k in range(gcd(N, M)):
    a = k * n
    b = k * m
    if S[a] != T[b]:
        print(-1)
        exit()

print(lcm)
N = int(input())
S = [int(input()) for _ in range(N)]
table = [False] * (100 * 100 + 1)
table[0] = True
ma = 0
for s in S:
    ma += s
    for i in range(ma, -1, -1):
        table[i+s] |= table[i]
for i in range(ma, -1, -1):
    if i % 10 != 0 and table[i]:
        print(i)
        break



### FIXED CODE ###

N = int(input())
S = [int(input()) for _ in range(N)]
table = [False] * (200 * 200 + 1)
table[0] = True
ma = 0
for s in S:
    ma += s
    for i in range(ma, -1, -1):
        table[i+s] |= table[i]
for i in range(ma, -1, -1):
    if i % 10 != 0 and table[i]:
        print(i)
        break
else:
    print(0)
ciar = input().split()
W,H,x,y,r = [ciar[0],ciar[1],ciar[2],ciar[3],ciar[4]]
if (x + r) <= W and (x - r) >= 0 :
    if (y + r) <= H and (y - r) >= 0 :
        print("Yes")
else :
    print("No")

### FIXED CODE ###

ciar = input().split()
W = int(ciar[0])
H = int(ciar[1])
x = int(ciar[2])
y = int(ciar[3])
r = int(ciar[4])
if (x + r) <= W and (x - r) >= 0 :
    if (y + r) <= H and (y - r) >= 0 :
        print("Yes")
    else :
        print("No")
else :
    print("No")
A, B, C, D, E, F = map(int, input().split())

mx = 0
ans = None
for a in range(0, F+1, A*100):
    for b in range(0, F-a+1, B*100):
        if a + b == 0:
            continue

        for c in range(0, F-a-b+1, C):
            for d in range(0, F-a-b-c+1, D):
                if c + d == 0:
                    continue
                x = 100 * (c + d) / (a + b)
                if x <= E and mx < x:
                    mx = x
                    ans = ((a + b + c + d), int(x))
print(*ans)


### FIXED CODE ###

A, B, C, D, E, F = map(int, input().split())
W = set()
for a in range(0, F+1, 100*A):
    for b in range(0, F+1, 100*B):
        W.add(a+b)
S = set()
for c in range(0, F+1, C):
    for d in range(0, F+1, D):
        S.add(c+d)

rate = -1
for w in W:
    for s in S:
        if 0 < w + s <= F and s * 100 <= E * w:
            if s / (s + w) > rate:
                rate = s / (s + w)
                ans = w + s, s
print(ans[0], ans[1])
N = int(input())
A = [int(i) for i in input().split()]
A = sorted(A)
removeNums = []
for i in range(len(A)-1):
    newValue = A[0] - A[-1]
    removeNums.append((A[0], A[-1]))
    A.remove(A[0])
    A.remove(A[-1])
    A.insert(0, newValue)

print(-1*A[0])
for i in range(len(removeNums)-1):
    print(removeNums[i][0], removeNums[i][1])

print(removeNums[-1][1], removeNums[-1][0])


### FIXED CODE ###

N, K = map(int, input().split())
print(N%K)
def S(): return stdin.readline().rstrip()
def I(): return int(stdin.readline().rstrip())


n = I()
s = S()

ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        if s[i] != s[j]:
            for k in range(j+1,n):
                if s[k] != s[i] and s[k] != s[j]:
                    if j-i != k-j:
                        ans += 1

print(ans)

### FIXED CODE ###

from sys import stdin
def S(): return stdin.readline().rstrip()
def I(): return int(stdin.readline().rstrip())
 
n = I()
s = list(S())

r = s.count('R')
g = s.count('G')
b = s.count('B')
 
ans = r*g*b
for i in range(n-1):
    for j in range(1,n):
        if i-j<0 or n<=i+j:
            break
        else:
            if s[i-j]!=s[i] and s[i]!=s[i+j] and s[i-j]!=s[i+j]:
                ans-=1
 
print(ans)
n = int(input())
a = list(map(int, input().split()))
cnt = 0
while max(a) != 0:
  # print(a,cnt)
  for i in range(n):
    if a[i] != 0:
      a[i] -= 1
      betweenZero = False
    elif betweenZero == False:
      cnt += 1
      betweenZero = True
  if betweenZero == False:
    cnt += 1
  betweenZero = True
print(cnt)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
cnt = 0
while max(a) != 0:
  # print(a,cnt)
  betweenZero = True
  for i in range(len(a)):
    if a[i] != 0:
      a[i] -= 1
      betweenZero = False
    elif betweenZero == False:
      cnt += 1
      betweenZero = True
  if betweenZero == False:
    cnt += 1
print(cnt)
S = input()
T = input()

count = 0
#iを３回数えてもらう
for i in range(3):
#数えてｓとｔが同じならカウント１とする
    if S[i]==T[i] 
    count += 1
print(count)

### FIXED CODE ###

S = input()
T = input()

count = 0
#iを３回数えてもらう
for i in range(3):
#数えてｓとｔが同じならカウント１とする
    if S[i]==T[i]:
        count += 1
print(count)
N = int(input())
S = list(str(input()))
x = 0
ans = 0

for i in range(len(N)):
  if S[i] == 'I':
    x += 1
  else:
    x -= 1
  if ans < x:
    ans = x
    
print(ans)

### FIXED CODE ###

N = int(input())
S = list(str(input()))
x = 0
ans = 0

for i in range(N):
  if S[i] == 'I':
    x += 1
  else:
    x -= 1
  if ans < x:
    ans = x
    
print(ans)
n=map(int,input().split())
if n<=105:
    print(0)
elif n<=135:
    print(1)
elif n<=189:
    print(2)
else:
    print(3)
    

### FIXED CODE ###

n=int(input())
if n<105:
    print(0)
elif n<135:
    print(1)
elif n<165:
    print(2)
elif n<189:
    print(3)
elif n<195:
    print(4)
else:
    print(5)
N,M = map(int,input().split())
AB = [[0,0]]*N
for n in range(N):
    temp = list(map(int,input().split()))
    if temp[0] <= M:
        AB[n] = list(map(int,input().split()))
work_schedule = [0]*M
sorted_AB = sorted(AB,key=lambda x:(-x[1],x[0]))
for work in sorted_AB:
    cnt = 0
    while True:
        if work[0]-1+cnt >= M:
            break
        elif work_schedule[work[0]-1+cnt] == 0:
            work_schedule[work[0]-1+cnt]  = work[1]
            break
        elif  work_schedule[work[0]-1+cnt] != 0:
            cnt+=1
print(sum(work_schedule))

### FIXED CODE ###

from collections import defaultdict
import heapq

n, m = map(int, input().split())
dct = defaultdict(list)

for i in range(n):
    a, b = map(int, input().split())
    dct[a].append(-b)

h = []
res = 0

for i in range(1, m + 1):
    if dct[i]:
        for item in dct[i]:
            heapq.heappush(h, item)
    if h:
        res += heapq.heappop(h)

print(-res)
from math import factorial
# 組み合わせ
def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

def main():
    num, k = map(int, input().split())

    if k >= num - 1:
        print('-1')
    else:
        edge = (num - 1) * 2 - k - 1
        edge += combinations_count(num - 2, 2)
        print(edge)
        for i in range(2 + k, num + 1):
            print(1, i)
        for i in range(2, num):
            print(num, i)
        for i in range(2, num):
            for j in range(i + 1, num):
                print(i, j)

if __name__ == '__main__':
    main()



### FIXED CODE ###


from math import factorial
# 組み合わせ
def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

def main():
    num, k = map(int, input().split())

    if num == 2:
        max_num = 10
    else:
        max_num = combinations_count(num - 1, 2)
    # max_num = combinations_count(num - 1, 2)

    if k > max_num or num == 2:
        if num == 2 and k == 0:
            print(1)
            print(1, 2)
        else:
            print('-1')
    else:
        edge = num - 1
        now_count = max_num
        data = [[num, i] for i in range(1, num)]
        for i in range(1, num):
            for j in range(i + 1, num):
                if now_count > k:
                    edge += 1
                    now_count -= 1
                    data.append([i, j])
                else:
                    pass

        print(edge)
        for i, j in data:
            print(i, j)

if __name__ == '__main__':
    main()
n = int(input())
x = list(map(int,input().split()))

ans = 10**20 #答えになるので初期化
for i in range(1,101): #1<=P<=100の範囲について消費する体力の総和を計算
    dis = 0
    for j in x:
        dis += (i-j)**2
    ans = min(dis)

print(ans)

### FIXED CODE ###

n = int(input())
x = list(map(int,input().split()))

ans = 10**20 #答えになるので初期化
for i in range(1,101): #1<=P<=100の範囲について消費する体力の総和を計算
    dis = 0
    for j in x:
        dis += (i-j)**2
    ans = min(ans,dis)

print(ans)
# -*- coding: utf-8 -*-
# problem B
y, x = map(int, input())
l = list(input() for i in range(y))
for i in range(y):
    print(l[i])
    print(l[i])

### FIXED CODE ###

#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
#from math import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

def main():
    h, w = map(int, input().split())
    C = [None] * h
    for i in range(h):
        C[i] = input()
    for i in range(h):
        print(C[i])
        print(C[i])

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

m = max(a,b,c)
print(m * 2 * k + a + b + c - max(a,b,c))

### FIXED CODE ###

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

if a <= b:
    print(a)
else:
    print(a - 1)