Harryxun/stf_run huggingface dataset:
N, A, B = map(int, input().split())

tmp = N%(A+B)
if 0 <= tmp <= A:
    print(A*(N//(A+B))+tmp)
else:
        print(A*(N//(A+B)))

### FIXED CODE ###

from math import floor, ceil

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

min1 = A/0.08
max1 = (A+0.9999999)/0.08
min2 = B/0.1
max2 = (B+0.9999999)/0.1

rangeMin = ceil(max(min1, min2))
rangeMax = floor(min(max1, max2))
if rangeMin > rangeMax:
    print(-1)
else:
    print(rangeMin)
import math
A,B = list(map(int,input_[0].split()))

A_min=12*A+math.floor(0.5*A)
A_max=12*(A+1)+math.ceil(0.5*(A+1))
B_min=10*B
B_max=10*(B+1)

print(A_min,A_max,B_min,B_max)
if A_max < B_min:
    print(-1)
elif B_max < A_min:
    print(-1)
else:
    print(max(A_,B_))

### FIXED CODE ###

import math
A,B = list(map(int,input().split()))
 
A_min=12*A+math.ceil(0.5*A)
A_max=12*(A+1)+math.floor(0.5*(A+1))
B_min=10*B
B_max=10*(B+1)
 
if A_max <= B_min:
    print(-1)
elif B_max <= A_min:
    print(-1)
else:
    print(max(A_min,B_min))
n,k=map(int, input().split())
s=str(input())
S=list(s)
if S[k]=='A':
  S[k]='a'
elif S[k]=='B':
  S[k]='b'
else:
  S[k]='c'
print(','.join(S))

### FIXED CODE ###

n,k=map(int, input().split())
s=str(input())
S=list(s)
if S[k-1]=='A':
  S[k-1]='a'
elif S[k-1]=='B':
  S[k-1]='b'
else:
  S[k-1]='c'
print(''.join(S))
str = input().strip()

a = int(str[1])
b = int(str[2])

if (b % a) == 0:
	print(a + b)
else:
	print(b-a)

### FIXED CODE ###

str = input().split()
a = int(str[0])
b = int(str[1])

if (b % a) == 0:
	print(a + b)
else:
	print(b-a)
#input
N, M = map(int, input().split())
u = [[] for i in range(N-1)]
for i in range(M):
    s, t = map(int, input().split())
    u[s-1].append(t-1)

#output
#（便宜的に地点から-1としておく）
u = [[]] * (N-1)
for v in s:
    u[v-1] = [t-1 for i, t in enumerate(t) if s[i] == v]

#地点vにたどり着く確率をp[v]とする。
p = [0] * N
p[0] = 1
for x, y in enumerate(u):
    for z in y:
        p[z] += p[x]/len(y)

#期待値をゴールから逆順に求めていく。点vからゴールまでの移動距離の期待値をq[v]とする。
q = [0] * N
q[N-1] = 0
for x, y in list(enumerate(u))[::-1]:
    q[x] = sum(q[z] for z in y)/len(y) + 1

v = [0] * N
for i in range(N-1):
    a = len(u[i])
    if a > 1:
        b = max(q[c] for c in u[i])
        v[i] = p[i]*(q[i] - (1+b))/(a-1)

print(q[0]+min(v))

### FIXED CODE ###

import sys
input = sys.stdin.readline

#input
N, M = map(int, input().split())
u = [[] for i in range(N-1)]
#（便宜的に地点から-1としておく）
for i in range(M):
    s, t = map(int, input().split())
    u[s-1].append(t-1)

#output
#地点vにたどり着く確率をp[v]とする。
p = [0] * N
p[0] = 1
for x, y in enumerate(u):
    for z in y:
        p[z] += p[x]/len(y)

#期待値をゴールから逆順に求めていく。点vからゴールまでの移動距離の期待値をq[v]とする。
q = [0] * N
q[N-1] = 0
for x, y in list(enumerate(u))[::-1]:
    q[x] = sum(q[z] for z in y)/len(y) + 1

v = [0] * N
for i in range(N-1):
    a = len(u[i])
    if a > 1:
        b = max(q[c] for c in u[i])
        v[i] = p[i]*(q[i] - (1+b))/(a-1)

print(q[0]+min(v))
#!/usr/bin/env python3
from sys import stdin, stdout

def rint():
   return map(int, stdin.readline().split())
lines = stdin.readlines()

a = input()
b = input()
if a[0] == b[2] and a[1] == b[1] and a[2] == b[0]:
   print("YES")
else:
   print("NO")

### FIXED CODE ###

#!/usr/bin/env python3
from sys import stdin, stdout

def rint():
   return map(int, stdin.readline().split())
#lines = stdin.readlines()

a = input()
b = input()
if a[0] == b[2] and a[1] == b[1] and a[2] == b[0]:
   print("YES")
else:
   print("NO")
#!/usr/bin/env python3
# coding=utf-8

import itertools
import sys

import numpy as np

n, k = map(int, sys.stdin.readline().strip().split(" "))
xyc = [l.strip().split(" ") for l in sys.stdin.readlines()]
xy = [tuple((int(_x), int(_y) if _c == "W" else int(_y) + k)) for (_x, _y, _c) in xyc]
xy = [tuple((_x % (2 * k), _y % (2 * k))) for (_x, _y) in xy]

check = np.zeros((n, 2*k, 2*k))
for _i, (_x, _y) in enumerate(xy):
    for _j, _k in itertools.product(range(2*k), range(2*k)):
        check[_i, _j, _k] = 1 if ((_j - _x) // k + (_k - _y) // k) % 2 == 0 else 0
print(int(np.max(np.sum(check, axis=0))))


### FIXED CODE ###

import numpy as np
N, K = map(int, input().split())
ub = K * 2
b = [[0 for j in range(ub + 1)] for i in range(ub + 1)]
ADD = {"B": 0, "W": K}


def create_bound(p, K, ub):
    if p - K + 1 >= 0:
        return [(p - K + 1, p + 1)]
    else:
        return [(0, p + 1), ((p - K + 1) % ub, ub)]


for i in range(N):
    x, y, c = input().split()
    nx = int(x) % ub
    ny = (int(y) + ADD[c]) % ub
    for add in [0, K]:
        for xlb, xub in create_bound((nx + add) % ub, K, ub):
            for ylb, yub in create_bound((ny + add) % ub, K, ub):
                b[xlb][ylb] += 1
                b[xlb][yub] -= 1
                b[xub][ylb] -= 1
                b[xub][yub] += 1

b_arr = np.array(b)
for i in range(ub):
    b_arr[i + 1, :] += b_arr[i, :]
for j in range(ub):
    b_arr[:, j + 1] += b_arr[:, j]
print(b_arr.max())
n = int(input())
i = n
m = 0
while i > 0
    m += i % 10
    i = i // 10

if n % m != 0:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

n = int(input())
i = n
m = 0
while i > 0:
    m += i % 10
    i = i // 10

if n % m != 0:
    print('No')
else:
    print('Yes')
n,w = map(int,input().split())

lis = [list(map(int,input().split())) for i in range(n)]
lis.sort(key = lambda x:x[1])

dp = {0:0}

for weight ,value in lis:
    gone = dp.copy()
    for key in dp:
        gone[key+value] = min(dp[key] + weight, dp.get(key+v, float("inf")))
    dp = gone
for key in sorted(dp.keys(), reverse = True):
    if dp[key] <= w:
        print(key)
        exit()

### FIXED CODE ###

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

lis = [list(map(int,input().split())) for i in range(n)]
lis.sort(key = lambda x:x[1])

dp = {0:0}

for weight ,value in lis:
    gone = dp.copy()
    for key in dp:
        gone[key+value] = min(dp[key] + weight, dp.get(key+value, float("inf")))
    dp = gone
for key in sorted(dp.keys(), reverse = True):
    if dp[key] <= w:
        print(key)
        exit()
r,D,x2000 = list(map(int, input().split()))

for i in  range(10):
    new =  r *x - D
    print(new)
    x = new


### FIXED CODE ###

r,D,x = list(map(int, input().split()))

for i in  range(10):
    new =  r *x - D
    print(new)
    x = new
s = list(input())
q = int(input())
rev = False
for i in range(q):
    print(input().split())
    if len(input()) == 1:
        if rev:
            rev = False
        else:
            rev = True
    else:
        if input()[2] == "1":
            a = input()[5]
            if rev:
                s.append(a)
            else:
                s.insert(0, a)
        else:
            a = input()[5]
            if rev:
                s.insert(0, a)
            else:
                s.append(a)
if rev:
    s.reverse()
print("".join(s))

### FIXED CODE ###

s = list(input())
q = int(input())
l1 = []
l2 = []
rev = False
for i in range(q):
    inp = input()
    if inp[0] == "1":
        if rev:
            rev = False
        else:
            rev = True
    elif inp[2] == "1":
        a = inp[4]
        if rev:
            l2.append(a)
        else:
            l1.append(a)
    else:
        a = inp[4]
        if rev:
            l1.append(a)
        else:
            l2.append(a)
l1.reverse()
ans = l1 + s + l2
if rev:
    ans.reverse()
print("".join(ans))
N = int(input())
A = map(int, input().split())

S = sum(A)
Y = [0]*N
Y[0] = S - 2*sum(A[1::2])
for i in range(1,N):
  Y[i] = 2*A[i-1] - Y[i-1]

print(*Y)

### FIXED CODE ###

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

S = sum(A)
Y = [0]*N
Y[0] = S - 2*sum(A[1::2])
for i in range(1,N):
  Y[i] = 2*A[i-1] - Y[i-1]

print(*Y)
from collections import Counter
N=int(input())
d={chr(i):100 for i in range(ord("a"),ord("z")+1)}
for i in range(N):
  A=Counter(list(input()))
  for i in A:
    if d[i]>A[i]:
      d[i]=A[i]
for i in d:
  if d[i]==100:
    d[i]=0
ans=""
for i in d:
  ans=d*d[i]+ans
print(ans)

### FIXED CODE ###

from collections import Counter
N=int(input())
d={chr(i):100 for i in range(ord("a"),ord("z")+1)}
for i in range(N):
  A={chr(i):0 for i in range(ord("a"),ord("z")+1)}
  A.update(Counter(list(input())))
  for i in A:
    if d[i]>A[i]:
      d[i]=A[i]
for i in d:
  if d[i]==100:
    d[i]=0
ans=""
key=sorted(d.keys())
for i in key:
  ans+=i*d[i]
print(ans)
D=input()
   
   if str.isupper(D):
       print("A")
   else:
        print("a")

### FIXED CODE ###

D=input()
if str.isupper(D):
	print("A")
else:
	print("a")
n, d = map(int, input().split())
x_l = [list(map(int, input().split)) for _ in range(n)]

ans = 0

for i in range(n):
    for j in range(i+1, n):
        tmp = 0
        for k in range(d):
            tmp += (x_l[j][k] - x_l[i][k]) ** 2
        if tmp**0.5%1 == 0:
            ans += 1

print(ans)


### FIXED CODE ###

n, d = map(int, input().split())
x_l = [list(map(int, input().split())) for _ in range(n)]

ans = 0

for i in range(n):
    for j in range(i+1, n):
        tmp = 0
        for k in range(d):
            tmp += (x_l[j][k] - x_l[i][k]) ** 2
        if tmp**0.5%1 == 0:
            ans += 1

print(ans)
import itertools
import math

n,d = map(int,input().split())
x = [[int(i) for i in input().split()] for i in range(n)] 
seq = list(itertools.combinations(range(n),d))
tmp = 0.0
cnt = 0

for i,j in seq:
    for k in range(d):
        tmp += (x[i][k] - x[j][k])**2
    tmp = math.sqrt(tmp)
    if tmp.is_integer():
        cnt += 1
print(cnt)

### FIXED CODE ###

import itertools
import math

n,d = map(int,input().split())
x = [[int(i) for i in input().split()] for i in range(n)] 
seq = list(itertools.combinations(range(n),2))
tmp = 0.0
cnt = 0
for i,j in seq:
    for k in range(d):
        tmp += (x[i][k] - x[j][k])**2
    tmp = math.sqrt(tmp)
    if tmp.is_integer():
        cnt += 1
    tmp = 0.0
print(cnt)
from sys import exit

N = int(input())

u = []
v = []
w = []

for i in range(N - 1):
    _u, _v, _w = map(int, input().split())
    u.append(_u)
    v.append(_v)
    w.append(_w)

reached = []
distances = {}


def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default


def search(x, distance):
    if x in reached:
        # 既に達しているところだったら
        return

    # 達したことを記録
    reached.append(x)
    distances[x] = distance

    while True:
        if x in u:
            index = u.index(x)
            new_x = v[index]
            new_distance = distance + w[index]

            u.pop(index)
            v.pop(index)
            w.pop(index)

            search(new_x, new_distance)
        elif x in v:
            index = v.index(x)
            new_x = u[index]
            new_distance = distance + w[index]

            u.pop(index)
            v.pop(index)
            w.pop(index)

            search(new_x, new_distance)
        else:
            break


search(1, 0)

for i in range(N):
    if i == 0:
        print(0)
        continue
    if distances[i + 1] % 2 == 0:
        print(0)
    else:
        print(1)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)

N = int(input())

q = {}

for i in range(N):
    q[i] = []

for _ in range(N - 1):
    _u, _v, _w = map(int, input().split())

    q[_u - 1].append((_v - 1, _w))
    q[_v - 1].append((_u - 1, _w))

ans = [None] * N
ans[0] = 0


def search(x, parent_num):
    for s in q[x]:
        if ans[s[0]] is None:
            ans[s[0]] = (parent_num + s[1]) % 2
            search(s[0], ans[s[0]])


search(0, 0)

for i in range(N):
    print(ans[i])
X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y>=600000000000000000:
  print(0/0)
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)

### FIXED CODE ###

X, Y=map(int,input().split())
num_2=Y/X
count=1
if X==1 and Y==576460752303423487:
  print(59)
  exit()
while num_2>=2:
    num_2=num_2/2
    count+=1
print(count)
n = input()
  
if n[-1] == '2' or n[-1] == '4' or n[-1] == '5' or n[-1] == '7' or n[-1] == '9' :
     print("hon")
elif n[-1] == '0' or n[-1] == '1' or n[-1] == '6' or n[-1] == '8' :
     print("pon")
elif n[-1] == '3':
      fmt.Println("bon")

### FIXED CODE ###

n = input()

if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
	print("hon")
elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == "8":
	print("pon")
elif n[-1] == "3":
  	print("bon")
a,b,c,d = map(int,input().split())
if d < a or b < c:
  print('No')
else:
  print('Yes')

### FIXED CODE ###

print('ACL'*int(input()))
print(("1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51".split(", "))[int(input())])

### FIXED CODE ###

s="1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
n=int(input())
print((s.split(", "))[n-1])
a=list(input())
a.remove(" ")
n=int(a[0])
k=int(a[1])
if(k>n):
    exit()
#n=int(input())
#k=int(input())
s=list(input())
str=""

s[k]=s[k].lower()
print(str.join(s))
#print(str)
#print(s)


### FIXED CODE ###

N,K=map(int,input().split())
S=list(input())
S[K-1]=S[K-1].lower()
print("".join(S))
n = int(input())
a_list = list(map(int, input().split()))

co = a_list.copy()
co.sort()
if 0 in co or len(co) % 2 == 1:
    co.remove(0)
else:
    print(0)
    quit()


for index in range(len(a_list)[:-1:2]):
    if not a_list[index] == a_list[index + 1]:
        print(0)
        quit()




print(int(pow(2, floor(n / 2))) % (pow(10,9) + 7))

### FIXED CODE ###

from math import factorial, floor
n = int(input())
a_list = list(map(int, input().split()))

co = a_list.copy()
if 0 in co:
    co.remove(0)
co.sort()


if not len(co) % 2 == 0:
    print(0)
    quit()

for index in range(len(a_list))[:-1:2]:
    if not co[index] == co[index + 1]:
        print(0)
        quit()


print(int(pow(2, floor(n / 2))) % (pow(10,9) + 7))
n = int(input())
d, x= map(int, input().split())
a = []
for i in range(n):
    a.append(int(input()))
c = n+x

for A in a:
    choco += int((d-1)/A)
print(c)
        



### FIXED CODE ###

n = int(input())
d, x= map(int, input().split())
a = []
for i in range(n):
    a.append(int(input()))
c = n+x

for A in a:
    c += int((d-1)/A)
print(c)
N=int(input())
if 7 in N:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N=input()
if '7' in N:
  print('Yes')
else:
  print('No')
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    print(A.count(i))

### FIXED CODE ###

R = int(input())

result = 3.1415926535*2*R
print(result)
n,m=input().split()
ans=0
for i in range(4,int(n)+1):
  for j in range(2,int(m[0])):
    for k in range(10):
      if i==j*k:
        ans+=1
for i in range(4,int(n)+1):
  for j in range(2,int(m[1])+1):
      if i==j*int(m[0]):
        ans+=1
print(ans)

### FIXED CODE ###

n,m=input().split()
if int(m)>=10:
    ans=0
    for i in range(4,int(n)+1):
      for j in range(2,int(m[0])):
        for k in range(2,10):
          if i==j*k:
            ans+=1
    for i in range(4,int(n)+1):
      for j in range(2,int(m[1])+1):
          if i==j*int(m[0]):
            ans+=1
    print(ans)
else:
  print(0)
S=input()
K=int(input())
i=0
while int(S[i])<2:
  i+=1
  if i==len(S)-1: break
print(int(S[i]))

### FIXED CODE ###

S=input()
K=int(input())
i=0
for i in range(len(S)):
  if int(S[i])>1:
    c=i
    break
if K>i:
  print(int(S[i]))
else:
  print(1)
import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
# import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    def make_divisors(a, b):
        divisors = []
        for i in range(1, min(a, b) + 1):
            if a % i == 0 and b % i == 0:
                divisors.append(i)

        # divisors.sort()
        return divisors

    a, b = ns()
    gcd = make_divisors(a, b)

    ans=0
    for i in range(len(gcd)):
        for j in range(i + 1, len(gcd)):
            if math.gcd(gcd[i], gcd[j]) == 0:
                ans += 1

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    a, b = ns()

    g = fractions.gcd(a, b)

    def search(n):
        i = 2
        so = []
        while not(n == 1 or i * i > n):
            while n % i == 0:
                n //= i
                so.append(i)
            i += 1
        if n != 1:
            so.append(n)

        return so

    ans = set(search(g))
    print(len(ans) + 1)


if __name__ == '__main__':
    main()
import turtle
kame = turtle.Turtle()
x = map(float,raw_input(),split(' '))
kame.goto(x[2],x[3])
print kame.distance(x[0],x[1])

### FIXED CODE ###

x = map(float,raw_input().split(' '))
import turtle
kame = turtle.Turtle()
kame.speed(0)
kame.goto(x[2],x[3])
print kame.distance(x[0],x[1])
N=int(input())
A=int(input())
ans%=500
if ans-A<=0:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

N=int(input())
A=int(input())
ans=N%500
if ans-A<=0:
    print('Yes')
else:
    print('No')
a, b, c = map(int. input().split())

ans = min(a + b, b + c)
ans = min(ans, c + a)
print(ans)

### FIXED CODE ###

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

ans = min(a + b, b + c)
ans = min(ans, c + a)
print(ans)
#coding:UTF-8
s = input().split()
a=int(s[0])
b=int(s[1])
c=int(s[2])
if(a>b):
    temp=a
    a=b
    b=tem
if(b>c):
    temp=b
    b=c
    c=temp
else:
    print (a,b,c)

### FIXED CODE ###

#coding:UTF-8
s = input().split()
a=int(s[0])
b=int(s[1])
c=int(s[2])
for i in range(2):
    if(a>b):
        temp=a
        a=b
        b=temp
    if(b>c):
        temp=b
        b=c
        c=temp
print (a,b,c)
import sys
input = sys.stdin.readline

def main():
    n,k=map(int,input().split())
    a=list(map(int,input().split()))
    ans=[0]*(int(n*(n-1)/2))
    cnt=0
    for i in range(n):
        for j in range(i,n):
            if i==j:
                continue
            else:
                ans[cnt]=a[i]*a[j]
            cnt+=1
    ans.sort()
    print(ans[k-1])
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np

def main():
    N, K = map(int,input().split())
    A = np.sort(np.array(list(map(int, input().split())), np.int64))
    z = A[A == 0]
    p = A[A > 0]
    n = A[A < 0]
    
    def count_func(x):
        cnt = 0
        if x >= 0:
            cnt += len(z) * N
        cnt += np.searchsorted(A, x // p, side='right').sum()
        cnt += (N - np.searchsorted(A, -(-x // n), side='left')).sum()
        cnt -= np.count_nonzero(A * A <= x)
        assert cnt % 2 == 0
        return cnt // 2
    
    l = -10 ** 18
    r = 10 ** 18
    while l + 1 < r:
        x = (l + r) // 2
        if count_func(x) >= K:
            r = x
        else:
            l = x
    
    print(r)
    
if __name__ == '__main__':
    main()
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): pass
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


s = S()
t = S()
si = len(s)
ti = len(t)
S,T = len(s),len(t)
dp = [[0]*(T+1) for _ in range(S+1)]
for i in range(S):
    for j in range(T):
        if s[i]==t[j]:
            dp[i+1][j+1] = 1 + dp[i][j]
        else:
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])



ans = ""
while si >= 0 or ti >= 0:
    if dp[si][ti] == dp[si - 1][ti - 1] + 1:
        si -= 1
        ti -= 1
        ans = s[si] + ans
    elif dp[si][ti] == dp[si - 1][ti]:
        si -= 1
    else:
        ti -= 1


if len(ans) == 0:
    print("")
else:
    print(ans)


### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from bisect import bisect_right, bisect_left
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gamma, log
from operator import mul
from functools import reduce
from copy import deepcopy

sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): pass
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7


s = S()
t = S()
S,T = len(s),len(t)
dp = [[0]*(T+1) for _ in range(S+1)]
for i in range(S):
    for j in range(T):
        if s[i]==t[j]:
            dp[i+1][j+1] = 1 + dp[i][j]
        else:
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])



ans = ""
while dp[S][T]:
    if dp[S - 1][T] == dp[S][T]:
        S -= 1
    elif dp[S][T - 1] == dp[S][T]:
        T -= 1
    else:
        S -= 1
        T -= 1
        ans = s[S] + ans


if len(ans) == 0:
    print("")
else:
    print(ans)
def gcd(a, b):
    if b > a:
        gcd(b, a)
    while b:
	    a, b = b, a % b
    return a

n,m = map(int, input().split())
s = input()
t = input()

l = n * m // gcd(n, m)
a = l // n
b = l // m
#print(a, b)
#a(i-1) = b(j-i) -> ai = bj + (a-b)
res = False
clear_all = True
for i in range(1,n+1):
    if (a*i - (a-b)) % b != 0:
        j = a * i - (a-b)
        if not s[i-1] == t[j-1]:
            clear_all = False
if clear_all:
    res = True
if res:
    print(l)
else:
    print(-1)
        

### FIXED CODE ###

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

n,m = map(int, input().split())
s = input()
t = input()

l = n * m // gcd(n, m)
a = l // n
b = l // m
#print(a, b)
#a(i-1) = b(j-i) -> ai = bj + (a-b)
res = False
clear_all = True
for i in range(1,n+1):
    if (a*i - (a-b)) % b == 0:
        j = (a * i - (a-b)) // b
        if not s[i-1] == t[j-1]:
            clear_all = False
if clear_all:
    res = True
if res:
    print(l)
else:
    print(-1)
import numpy as np

n = input()
a = np.array([int(i) for i in input().split()])
for i in range(int(n)):
    print(a.count(i+1))

### FIXED CODE ###

num = int(input())
h_numbers = list(map(int, input().split()))
s = [0] * num
for i in h_numbers:
    s[i-1] += 1
[print(i) for i in s]
if __name__=="__main__":
    # Problem B
    K = input()
    S = input()
    K_len = int(K)
    S_len = len(S)

    if S_len <= K_len:
        print(S)
    else:
        print(S[:K_len]+str("..."))


### FIXED CODE ###

if __name__=="__main__":
    # Problem A
    N = int(input())
    ones_digit = int(N)%10
    if ones_digit in [2, 4, 5, 7, 9]:
        print("hon")
    elif ones_digit in [0, 1, 6, 8]:
        print("pon")
    else:
        print("bon")