Harryxun/stf_run huggingface dataset:
import sys

#+++++
		
def main():
	n = int(input())
	s = input()
	count=0
	for i in range(1000):
		ss=str(i)
		if i < 10:
			ss = '00'+ss
		elif i < 100:
			ss='0'+ss
			
		if ss[0] in s:
			iia = s.index(ss[0])
		else:
			continue
		#pa(ii)
		if ss [1] in s[iia+1:]:
			iib = s[iia+1:].index(ss[1])+iia+1
		else:
			continue
		#pa(ii)
		if ss[2] in s[iib + 1:]:
			iic = s[iib+1:].index(ss[2])+iia+iib
		else:
			continue
			
		pa((ss,i))
		pa((iia,iib,iic,s[iia],s[iib],s[iic]))
		count+=1
			
	print(count)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

### FIXED CODE ###

import sys

#+++++
		
def main():
	n = int(input())
	s = input()
	count=0
	for i in range(1000):
		ss=str(i)
		if i < 10:
			ss = '00'+ss
		elif i < 100:
			ss='0'+ss
			
		if ss[0] in s:
			iia = s.index(ss[0])
		else:
			continue
		#pa(ii)
		if ss[1] in s[iia+1:]:
			iib = s[iia+1:].index(ss[1])+iia+1
		else:
			continue
		#pa(ii)
		if ss[2] in s[iib + 1:]:
			iic = s[iib+1:].index(ss[2])+iib+1
		else:
			continue
			
		#pa((ss,i))
		#pa((iia,iib,iic,s[iia],s[iib],s[iic]))
		count+=1
			
	print(count)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

 N,M = map(int,input().split())
 A = list(map(int,input().split()))
 S = [0]*N
 sum = 0
 ans = 0
 #二項係数とその逆元テーブルを作る前処理
 Max = N+1
 fac = [0]*(Max)
 finv = [0]*(Max)
 inv = [0]*(Max)
 fac[0]=fac[1]=1
 finv[0]=finv[1]=1
 inv[1]=1
 for i in range(2,Max):
         fac[i] = fac[i-1] * i % mod
         inv[i] = mod - inv[mod%i]*(mod//i)%mod
         finv[i] = finv[i-1]*inv[i]%mod
 #O(1)でmod計算した組合せ数を計算
 def Comb(n,r):
     if n < r:
         return 0
     if n < 0 or r < 0 :
         return 0
     return fac[n]*(finv[r]*finv[n-r]%mod)%mod
 
 for i in range(N):
     sum += A[i]
     if sum % M == 0:
         ans += 1
     S[i] = sum % M
 C = Counter(S)
 for n in C.values():
     ans += Comb(n,2)
 print(ans)

### FIXED CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
b = 0
d = {0:1}
ans = 0
for a in A:
    b = (b + a)%M
    ans += d.get(b,0)
    d[b] = d.get(b,0) + 1
print(ans)
A, B = map(int,input().split())

print('Yay!' if A <= 8 and B <= 8 else':(')


### FIXED CODE ###

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

print('Yes' if A<C<B or B<C<A else 'No')
n = int(input())

min_cnt = float('inf')
for i in range(n//6+1):
  cnt = 0
  t = i
  while t>6:
	cnt += t%6
  	t //= 6
  cnt += t
  
  for j in range((n-6*i)//9+1):
    t = j
    while t>9:
      cnt += t%9
      t //= 9
    cnt += t
    cnt += (n-6*i-9*j)
    if cnt < min_cnt:
      min_cnt = cnt
print(min_cnt)


### FIXED CODE ###

n = int(input())

min_cnt = float('inf')
for i in range(0, n+1, 9):
    cnt = 0
    t = i
    while t >= 9:
        cnt += t % 9
        t //= 9
    cnt += t

    t = (n-i)
    while t >= 1:
        cnt += t % 6
        t //= 6
    cnt += t

    if cnt < min_cnt:
        min_cnt = cnt
print(min_cnt)
from operator import mul
from functools import reduce


def cmb(n, r):
    if n <= r:
        return 1
    r = min(n - r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N, K = map(int, input().split(" "))
A = list(map(int, input().split(" ")))
A.sort()
fmax = 0
fmin = 0
for i in range(K, N+1):
    fmax += A[i-1] * cmb(i-1, K-1)
    fmin += A[-i] * cmb(i-1, K-1)
print((fmax - fmin) % 1000000007)


### FIXED CODE ###

n = input()
print(chr(ord(n) + 1))
import numpy as np

N = int(input())
b = np.array(list(map(int, input().split())))

v0 = np.array([0.5]*N)
A0 = np.diag(v0, k=0)
v1 = np.array([0.5]*(N-1))
A1 = np.diag(v1, k=1)
A = A0 + A1
A[N-1][0] = 0.5
Ainv = np.linalg.inv(A)
x = list(np.dot(Ainv, b))
x = [int(xj) for xj in x]
print(*x)

### FIXED CODE ###

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

S = [0]*(N+1)

for n in range(N):
    S[n+1] = S[n] + ((-1)**n)*b[n]
    
ans = [0]*N
for n in range(N):
    ans[n] = b[n] - ((-1)**n)*S[n] + ((-1)**n)*(S[N]-S[n+1])
    
print(*ans)
p=list(input())
a=int(a[0])
b=int(a[1])
c=int(a[2])
if a==7 or b==7 or c==7:
	print(Yes)
else:
	print(No)

### FIXED CODE ###

p=list(input())
a=int(p[0])
b=int(p[1])
c=int(p[2])
if a==7 or b==7 or c==7:
	print('Yes')
else:
	print('No')
n, k, m = map(int, input().split())
a = map(int, input().split())

if m * n - sum(a) <= 0:
    print(0)

elif 0 < m * n - sum(a) <= k:
    print(m * n - sum(a))
    
else:
    print('-1')

### FIXED CODE ###

alp = input()
asc = ord(alp)
print(chr(asc + 1))
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.input
n,q = map(int,input().split())
tree = [[] for i in range(n)]
for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    tree[a].append(b)
    tree[b].append(a)

ans = [0 for i in range(n)]
for i in range(q):
    p,x = map(int,input().split())
    p -= 1
    ans[p] += x

#入力

def dfs(pre,now,w):
    ans[now] += w
    for i in tree[now]:
        if i != pre:
            dfs(now,i,ans[now])

dfs(-1,0,0)

print(*ans)

### FIXED CODE ###

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

ans = [0 for i in range(n)]
for i in range(q):
    p,x = map(int,input().split())
    p -= 1
    ans[p] += x

#入力

stack = [0]
while len(stack) > 0:
    now = stack.pop()
    for i in tree[now]:
        ans[i] += ans[now]
        stack.append(i)

for i in range(n):
    print(ans[i],end=" ")
print()
x, y = input().split()
print('Alice') if (x + y) > 1 else print('Brown')


### FIXED CODE ###

x, y = map(int, input().split())
print('Alice') if abs(x - y) > 1 else print('Brown')
print('Christmas' + ' Eve' * (25) - int(input()))

### FIXED CODE ###

print('Christmas' + ' Eve' * (25 - int(input())))
H,M = map(int,input().split())
if M//2 == 0 :
    print(int(H*M/2))
else :
    prnt(int(H*M/2) + round(H/2))

### FIXED CODE ###

import math
H,M = map(int,input().split())
if H == 1 or M ==1 :
    print(1)
else :
    print(math.ceil((H*M)/2))
from collections import Counter

def main():
    N = int(input())
    *A, = map(int, input().split())
    A.sort()
    C = Counter(A)

    MAX = 2000005
    T = [0]*MAX

    ans = 0
    for a in A:
        if T[a]:
            continue
        else:
            if C[a] == 1:
                ans += 1
            for i in range(2*a, MAX, a):
                T[i] += 1
    print(ans)

@jit()

if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import Counter

def main():
    N = int(input())
    *A, = map(int, input().split())
    C = Counter(A)

    MAX = 1000005
    T = [0]*MAX

    ans = 0
    for a in C.keys():
        if T[a]:
            continue
        else:
            for i in range(2*a, MAX, a):
                T[i] = 1

    ans = 0
    for a, n in C.items():
        if n == 1 and T[a] == 0:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()
inp = input()
if inp.contains('7'):
  print("Yes")
 else:
  print("No")

### FIXED CODE ###

N = input()

print('Yes' if '7' in str(N) else 'No')
a,b = map(str, input().split())
print(a+b) if a+b <= 10 else print("error")

### FIXED CODE ###

a,b = map(int, input().split())
print(a+b) if a+b < 10 else print("error")
import math
a=int,input()
print(math.ceil(a//2))


### FIXED CODE ###

import math
N=int(input())
a=N/2
print(math.ceil(a))
N = int(input())
S = input()

c = S.count('1')
m = int('0B'+S, 0)
memo = [0]*(N+1)

def calc(a):
    global ans, memo
    if a == 0: return ans
    ans += 1
    if memo[a] != 0:
        b = memo[a]
    else:
        b = bin(a).count('1')
        memo[a] = b
    return calc(a%b)
    
for i in range(N):
    if S[i] == '1': b = c - 1
    else: b = c + 1
    if S[i] == '1':
        a = m - 2**(N - 1 - i)
    else: a = m + 2**(N - 1 - i)
    
    ans = 1
    print(calc(a%b))

### FIXED CODE ###

import math
N = int(input())
S = input()

lst0 = [0]*N
lst1 = [0]*N
lst0[0] = 1
lst1[0] = 1
c = S.count('1')
m0 = int(S[-1])
m1 = int(S[-1])
for i in range(1, N):
    lst0[i] += (lst0[i-1]*2)%(c+1)
    if c == 1:lst1[i] = 0
    else: lst1[i] += (lst1[i-1]*2)%(c-1)
    m0 += lst0[i] * int(S[N - 1- i])
    m0 %= c+1
    m1 += (lst1[i] * int(S[N - 1 - i]))
    if c == 1: m1 = 0
    else: m1 %= c-1

memo = [0]*(N+1)

def calc(a):
    global ans, memo
    if a == 0: return ans
    ans += 1
    if memo[a] != 0:
        b = memo[a]
    else:
        b = bin(a).count('1')
        memo[a] = b
    return calc(a%b)
    
for i in range(N):
    if S[i] == '1':
        b = c - 1
        if b == 0: a = 0
        else: a = max((m1 - lst1[N - 1 - i])%b, (m1 - lst1[N - 1 - i]+ b)%b)
    else:
        b = c + 1
        a = (m0 + lst0[N - 1 - i])%b
    if b == 0: print(0)
    elif a == 0:print(1)
    else:
        ans = 1
        print(calc(a))
k = int(input())
s = input()
n = len(s)
dp = [0]*(k+1)
dp[0] = 1

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 = 2000001
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 )


ans = 0
for i in range(n, n+k+1):
    ans += cmb(n+k, i) * pow(25, n+k-i, mod)
    ans %= mod

print(ans)


### FIXED CODE ###

k = int(input())
s = input()
n = len(s)

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 = 2000001
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 )


ans = 0
for i in range(n, n+k+1):
    ans += cmb(n+k, i, mod) * pow(25, n+k-i, mod)
    ans %= mod

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

A = sorted(A)
if A[N-1] < K:
    print("IMPOSSIBLE")
    exit()

min_A = A[0]
for i in range(1,N):
    min_A = min(min_A,A[i]-A[i-1])

for j in range(N):
    if A[j]%min_A != 0:
        print("POSSIBLE")
        exit()
if K % min_A == 0:
    print("POSSIBLE")
else:
    print("INPOSSIBLE")


### FIXED CODE ###

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

A = sorted(A)
if A[N-1] < K:
    print("IMPOSSIBLE")
    exit()

min_A = A[0]
for i in range(1,N):
    if A[i]-A[i-1] != 0:
        min_A = min(min_A,A[i]-A[i-1])

for j in range(N):
    if A[j]%min_A != 0:
        print("POSSIBLE")
        exit()
if K % min_A == 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
A=input()
B=input()
if A!=1 and B!=1:
  print(1)
elif A!=2 and B!=2:
  print(2)
else A!=3 and B!=3:
  print(3)

### FIXED CODE ###

A=int(input())
B=int(input())
ans = 6-A-B
print(ans)
from math import sin, radians, cos, sqrt
lst = [int(i) for i in input().split()]
A, B, H, M = tuple(lst)
angle = M * 6 - (H * 30 + M * 0.5)
if abs(angle) > 180:
  angle = 360 - abs(angle)
elif abs(angle) == 180:
  X = A + B
  print(X)
elif abs(angle) == 0:
  print(0)
else:
  angle = abs(angle)
  area = A * B * sin(radians(angle)) / 2
  co = sqrt(1 - sin(radians(angle)) ** 2)
  X = sqrt(A**2 + B**2 - 2*A*B*co)
  print(X)

### FIXED CODE ###

hon = [2, 4, 5, 7, 9]
pon = [0, 1, 6, 8]
bon = 3
N = input()
r = int(N[-1])
if r in hon:
  print('hon')
elif r in pon:
  print('pon')
else:
  print('bon')
return pow(2,q-1,q)==1

ans=0

a,b=map(int,input().split())
c=gcd(a,b)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
s=make_divisors(c)
print(s)
for i in s:
    ans=ans+is_prime(i)
print(ans+1)
    

### FIXED CODE ###

from itertools import combinations
from fractions import gcd

#coding:utf8
import random

def is_prime3(q,k=50):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    #n-1=2^s*dとし（但しaは整数、dは奇数)、dを求める
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True
ans=0

a,b=map(int,input().split())
c=gcd(a,b)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
s=make_divisors(c)
for i in s:
    ans=ans+is_prime3(i)
print(ans+1)
int(input())
A = [list(map(int,input().split())) for i in list(range(N))]
B = [[i[0]+i[1], i[0]-i[1]] for i in A]
B.sort()
prev=B[0]
cnt=N
for i in range(1,N):
  if prev[0]<B[i][1]:
    nt-=1
  else:
    prev=B[i]
print(cnt)  

### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    N = int(input())
    XL = [None] * N
    for n in range(N):
        X, L = map(int,input().split())
        XL[n] = [X-L,X+L]
    XL.sort(key=lambda x:x[1])
    ret = 1
    TMP = XL[0][1]
    for x in XL[1:]:
        if TMP<=x[0]:
            TMP = x[1]
            ret += 1
    print(ret)

if __name__ == '__main__':
    main()
n = int(input())
s = input()

if n % 2 != 0:
  print("No")
else:
  half = n // 2
  found = False
  for i in range(0, half + 1):
    if s[i] != s[half + i]:
      found = True
      break
  print("No" if found else "Yes")
  


### FIXED CODE ###

n = int(input())
s = input()

if n % 2 != 0:
  print("No")
else:
  half = n // 2
  found = False
  for i in range(0, half):
    if s[i] != s[half + i]:
      found = True
      break
  print("No" if found else "Yes")
N = input()
S = input()

T = ''

cnt = 0
cnt_list = []
for i in S:
  if len(T)==0:
    cnt+=1
    bef = i
  elif bef!=i:
    cnt+=1
    bef = i
  elif bef==i:
    cnt_list.append(cnt)
    cnt = 0
    
m = max(cnt_list)
print(m%(10**9+7))
    
    

### FIXED CODE ###

N = input()
S = input()
m = 1

for i in set(S):
    m *= S.count(i)+1
#     print(m, S.count(i))
print( (m-1) % (10**9+7) )
S,T=map(input().split())
print('S'end'')
print('T')


### FIXED CODE ###

S,T=map(str,input().split())
print('{}{}'.format(T,S))
import sys
from collections import Counter
H,W,m = map(int,input().split())
h_ls = [0] * H
w_ls = [0] * W
bombers = [[0,0] for _ in range(m)]
for i in range(m):
    h,w = map(int,input().split())
    h_ls[h-1] += 1
    w_ls[w-1] += 1
    bombers[i] = [h-1,w-1]

h_max = max(h_ls)
h_counter = Counter(h_ls)
# Couter使ってみる
h_max_args = [0]*h_counter[h_max]
next_ind = 0
for i in range(H):
    if h_ls[i] == h_max:
        h_max_args[next_ind] = i
        next_ind += 1

w_max = max(w_ls)
w_counter = Counter(w_ls)
w_max_args = [0]*w_counter[w_max]
next_ind = 0
for i in range(W):
    if w_ls[i] == w_max:
        w_max_args[next_ind] = i
        next_ind += 1

bombers = set(bombers)
for h in h_max_args:
    for w in w_max_args:
        if not [h,w] in bombers:
            print(w_max+h_max)
            sys.exit()

print(w_max+h_max-1)


### FIXED CODE ###

str_n = input()
keta = len(str_n)
not_zero = int(input())

dp = [[[0]*(not_zero+2) for _ in range(2)] for _ in range(keta+1)]
first = int(str_n[0])
dp[1][1][0] = 1
for k in range(1,10):
    if first == k:
        dp[1][0][1] += 1
    elif first > k:
        dp[1][1][1] += 1

for i in range(1,keta):
    # smallerからsmallerへの遷移
    for j in range(not_zero+1):
        # i桁目をゼロにする
        dp[i+1][1][j] += dp[i][1][j]
        # i桁目でゼロ以外を使う
        dp[i+1][1][j+1] += (dp[i][1][j])*9

    nex = int(str_n[i])
    # sameからsmallerへの遷移
    if not nex == 0:
        for j in range(not_zero+1):
            # i桁目をぜろにする
            dp[i+1][1][j] += dp[i][0][j]
            # i桁目でゼロ以外
            dp[i+1][1][j+1] += (dp[i][0][j]) * (nex-1)
    
    # sameからsameへの遷移
    if nex == 0:
        for j in range(not_zero+1):
            dp[i+1][0][j] = dp[i][0][j]
    else:
        for j in range(not_zero):
            dp[i+1][0][j+1] = dp[i][0][j]

print(dp[keta][1][not_zero] + dp[keta][0][not_zero])
n = int(input())
a = list(map(int, input().split()))

even_is_negative = 0
odd_is_nagative = 0

for i in range(n):
    if i % 2 == 0 and a[i] < 0:
        even_is_negative += 1
    elif i % 2 == 1 and a[i] < 0:
        odd_is_nagative += 1

# print(even_is_negative)
# print(odd_is_nagative)

sum = a[0]
change = 0

if even_is_negative >= odd_is_nagative:
    for i in range(1, n):
        if i % 2 == 1 and sum + a[i] <= 0:
            change += abs(sum + a[i]) + 1
            sum = 1
            # print("a " + str(sum))
        elif i % 2 == 0 and sum + a[i] >= 0:
            change += sum + abs(a[i]) + 1
            sum = -1
            # print("b " + str(sum))
        else:
            sum += a[i]
            # print("c " + str(sum))

if even_is_negative < odd_is_nagative:
    for i in range(1, n):
        if i % 2 == 1 and sum + a[i] >= 0:
            change += sum + abs(a[i]) + 1
            sum = -1
            # print("a " + str(sum) + str(change))
        elif i % 2 == 0 and sum + a[i] <= 0:
            change += abs(sum + a[i]) + 1
            sum = 1
            # print("b " + str(sum)+ str(change))
        else:
            sum += a[i]
            # print("c " + str(sum)+ str(change))

if sum == 0:
    print(change + 1)
else:
    print(change)
             

### FIXED CODE ###

s = input().split()
a = ""

for i in range(len(s)):
    str = s[i][0]
    a += str.upper()

print(a)
S = int(input())

for i in range(int(S**0.5)+1, 1, -1):
    if S%i == 0:
        y = i
        break

x = int(S//y)

print(*[0, 0, 0, y, x, 0])



### FIXED CODE ###

S = int(input())

v = 10**9

x = (v-S%v)%v
y = int((S+x)/v)

print(*[0, 0, v, 1, x, y])
a,b=map(int,input().split())
if b * 10 <= ((a  * 25 + 24) // 2 and -(-a * 25 // 2) < (b + 1) * 10:
    print(max(-(-a*25//2), b * 10))
else:
    print(-1)

### FIXED CODE ###

import math

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

for i in range(b+1,1001):
    if math.floor(i * 0.08) == a and math.floor(i * 0.1) == b:
        ans = i
        break
else:
    ans = -1
print(ans)
N = int(input())
S=input()
if 7 in S:
  print('Yes')
else:
  print( 'No')

### FIXED CODE ###

S=input()
if '7' in S:
  print('Yes')
else:
  print( 'No')
a, b, k = map(int, input().split())
l = list(range(a, b + 1))
s = set(l[:k])
s.update(l[-k:])
s = sorted(s)
print('\n'.join(map(str, s)))

### FIXED CODE ###

a, b, k = map(int, input().split())
s = set(range(a, min(b + 1, a + k)))
s.update(range(b, max(a - 1, b - k), -1))
s = sorted(s)
print('\n'.join(map(str, s)))
A, B, N = map(int, input().split(" "))

ans = 0
count = 0
num = int(N / B)
array = list(range(N, B * num,-1))
array.append(i for i in range(B * num, -1, -B))
# print(array
for x in range(N,0,-1):
    if count > 1000000:
        break
    xb = x / B
    if xb < 1 and ans != 0:
        count += 1
#         print("continue")
        continue
    floor = int(A*xb) - A * int(xb)
    if ans < floor:
#         print(x)
#         print(x,count)
        count = 0
        ans = floor
    count += 1
print(ans)

### FIXED CODE ###

A, B, N = map(int, input().split(" "))
ans = 0
x = min(B-1,N)
floor = int(A*x/B) - A * int(x/B)
print(floor)
for e in iter(input,'0 0'):
 w,h=map(int,e.split())
 M=[[[1,0]*2 for _ in[0]*h]for _ in[0]*w]
 for i in range(1,w):
  for j in range(1,h):
   a=M[i-1][j][:2]
   b=M[i][j-1][2:]
   M[i][j]=[b[1],a,a[1],b]
 print((sum(M[w-2][h-1][:2])+sum(M[w-1][h-2][2:]))%10**5)


### FIXED CODE ###

def s():
 for e in iter(input,'0 0'):
  w,h=map(int,e.split())
  M=[[[1,0]*2 for _ in[0]*h]for _ in[0]*w]
  for i in range(1,w):
   for j in range(1,h):
    a,b=M[i-1][j][:2]
    c,d=M[i][j-1][2:]
    M[i][j]=[d,a+b,b,c+d]
  print((sum(M[w-2][h-1][:2])+sum(M[w-1][h-2][2:]))%10**5)
s()
#!/usr/bin/env python3
def main():
    import sys

    sys.setrecursionlimit(10 ** 4)

    def search_loop(now: int, loop: list):
        """iから探索を初めて，再びiに達するまでに通った点のスコアをリストとして返す"""
        seen[now] = True
        if now == i and loop:
            loops.append(loop)
            return
        loop.append(C[now])
        search_loop(P[now], loop)

    N, K = map(int, input().split())
    P = [int(x) - 1 for x in input().split()]
    C = [int(x) for x in input().split()]

    # ループを探す
    seen = [False] * N
    loops = []
    for i in range(N):
        if not seen[i]:
            search_loop(i, [])

    # ループごとの最大スコアを探す
    ans = -10 ** 9
    for loop in loops:
        length = len(loop)
        sum_loop = sum(loop)
        # ループ長よりも操作回数が多いか？，ループを周回すると得か？で場合分け
        res = 0 if sum_loop <= 0 else sum_loop * (K // length)
        limit = K if K <= length else K % length

        loop_temp = loop * 2  # loopリストに同じloopリストを接続する
        for i in range(length):
            lst = [res]
            # cal = res
            for k in range(limit):
                # cal += loop_temp[i + k]
                # ans = max(ans, cal)
                lst.append(lst[-1] + loop_temp[i + k])
            ans = max(ans, max(lst[1:]))
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
def main():
    N, K = map(int, input().split())
    P = [int(x) - 1 for x in input().split()]
    C = [int(x) for x in input().split()]

    ans = -10 ** 9
    for start in range(N):
        # ループを探す
        now = start
        loop = []
        total = 0
        while now != start or not loop:
            loop.append(C[now])
            now = P[now]
            total += C[now]
        # ループごとの最大スコアを探す
        length = len(loop)
        # sum_loop = sum(loop)
        # # ループ長よりも操作回数が多いか？，ループを周回すると得か？で場合分け
        # res = 0 if sum_loop <= 0 else sum_loop * (K // length)
        # limit = K if K <= length else K % length
        # for k in range(limit):
        #     res += loop[k]
        #     ans = max(ans, res)
        t = 0
        for i in range(length):
            t += loop[i]
            if i + 1 > K:
                break
            now = t
            if total > 0:
                e = (K - (i + 1)) // length
                now += total * e
            ans = max(ans, now)
    print(ans)


if __name__ == '__main__':
    main()
a,b=input().strip().split(' ')
a,b=[int(a),int(b)]
cn=0
c=[int(x) for x in input().split(' ')]
for i in c:
  if i>=c:
    cn+=1
print(cn)

### FIXED CODE ###

a,b=input().strip().split(' ')
a,b=[int(a),int(b)]
co=0
c=list(map(int,input().strip().split(' ')))
for i in c:
  if i>=b:
    co+=1
print(co)
s = input()
t = input()
for _ in range(len(s)):
    s = s[len(s)-1]+"".join[s[i] for i in range(len(s)-1)]
    if s == t:
        print("Yes")
        exit()
        
print("No")

### FIXED CODE ###

s = input()
t = input()
cnt = 1
for _ in range(len(s)):
    a = s[len(s)-1]
    b = [s[i] for i in range(len(s)-1)]
    bb = "".join(b)
    s = a+bb
    if s == t:
        cnt *= 0

print("No") if cnt else print("Yes")
A,B = map(int,input().split( ))
B_0 = B//1
B_1 = B%1
ans_0 = round(A*B_0)
ans_1 = A*round(B_1*100)//100
print(int(ans_0 + ans_1))

### FIXED CODE ###

A,B = map(float,input().split( ))
A = int(round(A))
B_0 = B//1
B_1 = B%1
ans_0 = round(A*B_0)
ans_1 = A*round(B_1*100)//100
print(int(round(ans_0 + ans_1)))
import math

a, b= map(int, input().split())
def lcm(x,y):
    return x*y/math.gcd(x, y)

print(int(lcm(a, b)))


### FIXED CODE ###

import fractions as fr

a, b= map(int, input().split())
def lcm(x,y):
    return (x*y/fr.gcd(x,y))

print(int(lcm(a,b)))