Harryxun/stf_run huggingface dataset:
N = int(input())

lastnum = N[-1]

if lastnum in [0,1,6,8]
print("pon")

elsif lastnum in [3]
print("bon")

else
print("hon")


### FIXED CODE ###

def solve(n):
    p = n % 10
    if p in [2,4,5,7,9]:
        return "hon"
    elif p in [0,1,6,8]:
        return "pon"
    else:
        return "bon"

n = int(input())
print(solve(n))
import bisect

X,N = (int(x) for x in input().split())
P = list(map(int, input().split()))
ALL = list(int(i) for i in range(1,101))
P.sort()
Q = list(set(P)^set(ALL))
number = bisect.bisect(Q,X)

if number==0:
  print(Q[0])
elif number==len(Q):
  print(Q[len(Q)-1])
elif X-Q[number-1]<=Q[number]-X:
  print(Q[number-1])
elif X-Q[number-1]>Q[number]-X:
  print(Q[number])


### FIXED CODE ###

import bisect

X,N = (int(x) for x in input().split())
P = list(map(int, input().split()))
ALL = list(int(i) for i in range(-100,201))
P.sort()
Q = list(set(P)^set(ALL))
number = bisect.bisect(Q,X)

if number==0:
  print(Q[0])
elif number==len(Q):
  print(Q[len(Q)-1])
elif X-Q[number-1]<=Q[number]-X:
  print(Q[number-1])
elif X-Q[number-1]>Q[number]-X:
  print(Q[number])
n = int(input())
s = input()

ans = 0
for i in range(n-2):
    if s[i]+s[i+1] == "#.":
        if s[i+2] == "#":
            s.replace(s[i+1],"#")
            ans += 1
        if s[i+2] == ".":
            s.replace(s[i+1],".")
            ans += 1
if s[-2]+s[-1] == "#.":
    s.replace(s[i+1],"#")
    ans += 1
print(ans)

### FIXED CODE ###

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

if a<c<b or a>c>b:
    print("Yes")
else:
    print("No")
import sys
def main():
	A,B,C,D = map(int, input().split())
	while True:
		C - B
		if C <= 0:
			print("Yes")
		A - D
		if A <= 0:
			print("No")
			sys.exit()
main()


### FIXED CODE ###

S,W = map(int, input().split())

if W >= S:
	print("unsafe")

elif W < S:
	print("safe")
n = int(raw_input())
d = [100 for i in range(n)]
G = [0 for i in range(n)]
v = [[0 for i in range(n)] for j in range(n)]
  
def Bread(s):
    for e in range(n):
        if v[s][e] == 1:
            if d[e] > d[s] + 1:
                d[e] = d[s]+1
                Bread(e)
  
for i in range(n):
    G = map(int, raw_input().split())
 
    for j in range(G[1]):
        v[G[0]-1][G[j+2]-1] = 1
 
d[0] = 0
  
for i in range(n):
    Bread(i)
 
for i in range(n):
    if d[i] == 100:
        d[i] = -1
 
for i in range(n):
    print i+1, d[i]
 

 
Compile Error Logs: 

You are not authorized to see the message. 
 
 
Status 
Judge: 8/8  Python  CPU: 00.04 sec  Memory: 6492 KB  Length: 531 B  2016-02-02 22:02  2016-02-02 22:02  
Results for testcases 
Case # Verdict CPU Time Memory In Out Case Name 
 Case #1: : Accepted  00.01 sec 6476 KB 40 B 26 B 1.in 
 Case #2: : Accepted  00.00 sec 6280 KB 20 B 12 B 2.in 
 Case #3: : Accepted  00.00 sec 6472 KB 75 B 41 B 3.in 
 Case #4: : Accepted  00.00 sec 6304 KB 62 B 20 B 4.in 
 Case #5: : Accepted  00.00 sec 6320 KB 158 B 96 B 5.in 
 Case #6: : Accepted  00.00 sec 6364 KB 355 B 152 B 6.in 
 Case #7:  

### FIXED CODE ###

n = int(raw_input())
d = [100 for i in range(n)]
G = [0 for i in range(n)]
v = [[0 for i in range(n)] for j in range(n)]
  
def Bread(s):
    for e in range(n):
        if v[s][e] == 1:
            if d[e] > d[s] + 1:
                d[e] = d[s]+1
                Bread(e)
  
for i in range(n):
    G = map(int, raw_input().split())
 
    for j in range(G[1]):
        v[G[0]-1][G[j+2]-1] = 1
 
d[0] = 0
  
for i in range(n):
    Bread(i)
 
for i in range(n):
    if d[i] == 100:
        d[i] = -1
 
for i in range(n):
    print i+1, d[i]
import math
N = int(input())
temp = N
arr = []
for i in range(2,int(-(-N**0.5//1))+1):
	if temp % i==0:
		cnt = 0
		while temp%i==0:
			cnt+=1
			temp//=i
		arr.append([i,cnt])
if temp!=1:
	arr.append([temp,1])
if arr == []:
	arr.append([n,1])
sum = 0
for i in range(len(arr)):
  p = arr[i][1]
  q = 1
  while p > 0:
    p -= q
    if p >= 0:
      sum += 1
      q += 1
print(sum)

### FIXED CODE ###

import math
import sys
N = int(input())
temp = N
arr = []
if N == 1:
  print('0')
  sys.exit()
for i in range(2,int(-(-N**0.5//1))+1):
	if temp % i==0:
		cnt = 0
		while temp%i==0:
			cnt+=1
			temp//=i
		arr.append([i,cnt])
if temp!=1:
	arr.append([temp,1])
if arr == []:
	arr.append([n,1])
sum = 0
for i in range(len(arr)):
  p = arr[i][1]
  q = 1
  while p > 0:
    p -= q
    if p >= 0:
      sum += 1
      q += 1
print(sum)
import sys
from collections import defaultdict
import bisect
sys.setrecursionlimit(10 ** 7)

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

S = sr()
T = sr()
len_S = len(S)
indexes_S = defaultdict(list)
for i, s in enumerate(S):
    indexes_S[s].append(i)

x = -1 # 今いるところ、次はx+1から探索
for t in T:
    if indexes_S[t] == 0:
        print(-1); exit()
    arr = indexes_S[t]
    y = (x+1) % len_S
    next_i = bisect.bisect_left(arr, y) # tの同じ文字がある次のindex
    if next_i < len(arr):
        x = (x+1) + arr[next_i] - y
    else:
        x = (x+1) + arr[0] + len_S - y # 1周して次のarr

print(x+1)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from collections import defaultdict
from bisect import bisect_left

S = input().rstrip()
T = input().rstrip()

LS = len(S)

index = defaultdict(list)

for i,s in enumerate(S):
    index[s].append(i)

x = -1
for t in T:
    arr = index[t]
    if len(arr) == 0:
        x = -2
        break
    y = (x+1) % LS
    i = bisect_left(arr,y)
    if i < len(arr):
        next_x = (x+1) + arr[i] - y
    else:
        next_x = (x+1) + arr[0] - y + LS
    x = next_x

print(x + 1)
N = int(input())
ans = 0
for i in range(N):
  a, b = input().split()
  if b == 'JPY':
    ans += int(a)
  else:
    ans += int(a)*380000
print(ans)

### FIXED CODE ###

N = int(input())
ans = 0.0
for i in range(N):
  a, b = input().split()
  if b == 'JPY':
    ans += float(a)
  else:
    ans += float(a)*380000
print(ans)
b.py  a.py                                                                    X
l = raw_input().split(" ")


a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]

ans="No"

if (l[0] in a and l[1] in a):
    ans="Yes"
if (l[0] in b and l[1] in b):
    ans="Yes"
if (l[0] in c and l[1] in c):
    ans="Yes"

print(ans)


### FIXED CODE ###

l = raw_input().split(" ")
#print(l[0])
#print(l[1])

a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]

ans="No"


if (int(l[0]) in a and int(l[1]) in a):
    ans="Yes"

if (int(l[0]) in b and int(l[1]) in b):
    ans="Yes"

if (int(l[0]) in c and int(l[1]) in c):
    ans="Yes"

print(ans)
m,d=input().strip().split(' ')
m,d=[int(m),int(d)]
c=0
for i in range(22,d+1):
  d1=str(d)
  if int(d1[1])>=2 and int(d1[1]*d1[0])<=m:
    c+=1
print (c)



### FIXED CODE ###

m,d=input().strip().split(' ')
m,d=[int(m),int(d)]
c=0
for i in range(22,d+1):
  d1=str(i)
  if int(d1[1])>=2 and int(d1[1])*int(d1[0])<=m:
    c+=1
print (c)
N, K = map(int, input().split())
A = list(map(int, input().split()))

l = 0
r = max(A)
while l != r:
    mid = (r + l) // 2
    count = 0
    for log in A:
        if log > mid:
            count += (log - 1) // mid
    if count <= K:
        r = mid
    else:
        l = mid + 1

print(r)


### FIXED CODE ###

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

l = 0
r = max(A)
for _ in range(100):
    mid = (r + l + 1) // 2
    count = 0
    for log in A:
        if log > mid:
            count += (log + mid - 1) // mid - 1
    if count <= K:
        r = mid
    else:
        l = mid

print(r)
a,b,c = map(int,input().split())
import sympy
if sympy.sqrt(a)+sympy.sqrt(b) <sympy.sqrt(c):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import decimal
a,b,c = map(decimal.Decimal,input().split())
roota = decimal.Decimal.sqrt(a)
rootb = decimal.Decimal.sqrt(b)
rootc = decimal.Decimal.sqrt(c)
if roota + rootb < rootc:
  print("Yes")
else:
  print("No")
import itertools
import math
from collections import deque
from collections import defaultdict
from itertools import permutations
import heapq
import bisect
from scipy.sparse.csgraph import floyd_warshall as wf
from collections import Counter
from itertools import*
from bisect import bisect_left,bisect_right
from collections import Counter
from functools import reduce
inf = 10**10
import sys
input = sys.stdin.readline
def gcd_list(numbers):
    return reduce(math.gcd,numbers)
n = int(input())
a = list(map(int,input().split()))
index = inf
if n == 2:
    print(max(a))
else:
    a.sort()
    if math.gcd(a[0],a[n-1]) == 1:
        print(max(gcd_list(a[1:n]),gcd_list(a[0:n-1])))
    else:
        for i in range(1,n-1):
            ans = math.gcd(a[0],a[n-1])
            if math.gcd(a[i]-a[0],a[n-1]-a[i]) <= ans:
                index = i
                ans = math.gcd(a[i]-a[0],a[n-1]-a[i])
        print(gcd_list(a[0:i]+a[i+1:n]))

### FIXED CODE ###

from functools import reduce
inf = 10**10
import sys
input = sys.stdin.readline


def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
def gcd_list(numbers):
    return reduce(gcd,numbers)
n = int(input())
a = list(map(int,input().split()))
index = inf
if n == 2:
    print(max(a))
else:
    a.sort()
    if gcd(a[0],a[n-1]) == 1:
        print(max(gcd_list(a[1:n]),gcd_list(a[0:n-1])))
    else:
        ans = gcd(a[0],a[n-1])
        for i in range(1,n-1):
            if gcd(a[i]-a[0],a[n-1]-a[i]) <= ans:
                index = i
                ans = gcd(a[i]-a[0],a[n-1]-a[i])
        print(max(gcd_list(a[0:index]+a[index+1:n]),gcd_list(a[1:n]),gcd_list(a[0:n-1])))
AB = input().split()
A,B = int(AB[0]),int(AB[1])

count=0
def is_prime(n):
  flag=True
  while i;i<=sqrt(n);i+=1:
	if n%i != 0:
      flag = False
      break
      
for i in range(min(A,B)):
  if is_prime(i)
	if A%i==0 and B%i==0:
      count+=1
      
print(count)

### FIXED CODE ###

import math
def prime(n):
    flag = True
    if n==1 or n==2:
        return True
    for i in range(2,math.ceil(math.sqrt(n))+1):
        if n%i == 0:
            flag = False
            break
    return flag

a,b=map(int,input().split())
A=set()
B=set()

for i in range(1,math.ceil(math.sqrt(a))+1):
    if a%i == 0:
        A.add(i)
        A.add(a//i)

for i in range(1,math.ceil(math.sqrt(b))+1):
    if b%i == 0:
        B.add(i)
        B.add(b//i)

A=[num for num in A if prime(num)]
B=[num for num in B if prime(num)]

ans=0
for b in B:
    if b in A:
        ans+=1
print(ans)
input()
nums = [ int(i) for i in input().split()]

print( min(mums), max(nums), sum(nums))

### FIXED CODE ###

input()
nums = [ int(i) for i in input().split()]
 
print( min(nums), max(nums), sum(nums))
p=10**9+7
ans1=1
ans2=1

for i in range(n-a+1,n+1):
    ans1*=i
    ans1%=p

for i in range(1,a+1):
    ans1*=pow(i,p-2,p)
    ans1%=p
    
for i in range(n-b+1,n+1):
    ans2*=i
    ans2%=p

for i in range(1,b+1):
    ans2*=pow(i,p-2,p)
    ans2%=p

print((pow(2,n,p)-ans1-ans2-1)%p)

### FIXED CODE ###

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

p=10**9+7
ans1=1
ans2=1

for i in range(n-a+1,n+1):
    ans1*=i
    ans1%=p

for i in range(1,a+1):
    ans1*=pow(i,p-2,p)
    ans1%=p
    
for i in range(n-b+1,n+1):
    ans2*=i
    ans2%=p

for i in range(1,b+1):
    ans2*=pow(i,p-2,p)
    ans2%=p

print((pow(2,n,p)-ans1-ans2-1)%p)
n, m = [int(x) for x in input().split(' ')]

edges = set([tuple(input().split(' ')) for _ in range(n)])
edges.update([(x[1], x[0]) for x in list(edges)])


def dfs(node, history):
    ans = 0
    if len(history) == n:
        return 1

    nextnodes = [
        x[1] for x in edges if x[1] not in history and x[0] == node and x[1] != node
    ]
    for next in nextnodes:
        ans += dfs(next, history | set(next))
    return ans


print(dfs('1', set(['1'])))

### FIXED CODE ###

n, m = [int(x) for x in input().split(' ')]
 
edges = set([tuple(input().split(' ')) for _ in range(m)])
edges.update([(x[1], x[0]) for x in list(edges)])
 
 
def dfs(node, history):
    ans = 0
    if len(history) == n - 1:
        return 1
 
    nextnodes = [
        x[1] for x in edges if x[1] not in history and x[0] == node and x[1] != node
    ]
    history.add(node)
    for next in nextnodes:
        ans += dfs(next, history)
    history.remove(node)
    return ans
 
 
print(dfs('1', set()))
if S == 'Sunny'
print('Cloudy')
elif S == 'Cloudy'
print('Rainy')
else
print('Sunny')

### FIXED CODE ###

S = input()
if S == 'Sunny':
	print('Cloudy')
elif S == 'Cloudy':
	print('Rainy')
elif S == 'Rainy':
	print('Sunny')
N = int(input())
if N % 2 == 0:
else:
  print(0)

### FIXED CODE ###

L = [10, 50, 250, 1250, 6250, 31250, 156250, 781250, 3906250, 19531250, 97656250, \
     488281250, 2441406250, 12207031250, 61035156250, 305175781250, 1525878906250, \
     7629394531250, 38146972656250, 190734863281250, 953674316406250, \
     4768371582031250, 23841857910156250, 119209289550781250, 596046447753906250]
N = int(input())
A = 0
if N % 2 == 0:
  for i in L:
    A += N // i
print(A)
N,W = map(int,input().split())

dp = [0]*(W+1)
L = []
for i in range(N):
    w,v = map(int,input().split())
    L.append([v,w])

for i in range(N):
    for w in range(W+1):
        if w-L[i][1]>=0 :dp[w] = max(dp[w],dp[w-L[i][1]]+L[i][0])
print(dp[-1])

### FIXED CODE ###

N, W = map(int, input().split())
a = []
for i in range(N):
    x,y = map(int,input().split())
    a.append([x,y])
max_v, inf = 10**5, float("inf")
dp = [0] + [inf]*max_v
 
for w, v in a:
    for i, j in zip(range(max_v-v, -1, -1), range(max_v, -1, -1)):
        if dp[i]+w <= W and dp[j] > dp[i]+w:
            dp[j] = dp[i]+w
 
for weight, value in zip(dp[::-1], range(max_v, -1, -1)):
    if weight != inf:
        print(value)
        break
n, k = map(int, input().split())
Li = list(map(int, input().split()))
Li.reverse()

length = 0
for l, i in Li:
  length += 0
  if i == k - 1:
    break
    
print(length)

### FIXED CODE ###

n, k = map(int, input().split())
Li = list(map(int, input().split()))
Li.sort(reverse=True)

length = 0
for i, l in enumerate(Li):
  length += l
  if i == k - 1:
    break
    
print(length)
P,Q,R = map(int.input().split())
 
print(min(P+Q,Q+R,R+P))

### FIXED CODE ###

P,Q,R = map(int,input().split())
 
print(min(P+Q,Q+R,R+P))
r=int(input())
g=int(input())
print(2*b-a)

### FIXED CODE ###

r=int(input())
g=int(input())
print(2*g-r)
import sys

sys.setrecursionlimit(100000)

def calc_state_number(stair_num, now_stair, damaged_step_set, memo):
    # print(str(now_stair) + '/' + str(stair_num))
    if memo[now_stair-1] != -1:
        return memo[now_stair-1]
    if now_stair in damaged_step_set:
        memo[now_stair-1] = 0
        return memo[now_stair-1]
    if now_stair > stair_num:
        memo[now_stair-1] = 0
        return memo[now_stair-1]
    if now_stair == stair_num:
        memo[now_stair-1] = 1
        return memo[now_stair-1]
    memo[now_stair-1] = (calc_state_number(stair_num, now_stair+1, damaged_step_set, memo) + calc_state_number(stair_num, now_stair+2, damaged_step_set, memo))%1000000007
    return memo[now_stair-1]

if __name__ == '__main__':
    N, M = map(int, input().split())
    a = [int(input()) for _ in range(M)]
    a = sorted(a)

    memo = [-1] * (N*2)

    answer = 1
    if a[-1::] == N:
        answer = 0

    for i in range(1, M):
        if a[i-1] + 1 == a[i]:
            answer = 0

    if answer != 0:
        answer = calc_state_number(N, 0, set(a), memo)

    print(answer)

### FIXED CODE ###

if __name__ == '__main__':
   n, m = map(int,input().split())
   a = set([int(input()) for i in range(m)])

   MOD = 1000000007

   dp = [0 for i in range(n+1)]
   dp[0] = 1
   if 1 in a:
      dp[1] = 0
   else:
      dp[1] = 1

   for i in range(2,n+1):
      if (i-1 in a) and (i-2 in a):
         dp[i] = 0
      elif i-1 in a:
         dp[i] = dp[i-2] % MOD
      elif i-2 in a:
         dp[i] = dp[i-1] % MOD
      else:
         dp[i] = (dp[i-1] + dp[i-2]) % MOD

   print(dp[n])
A, B = map(int,inpt().split())
print(max(A + B, A- B, A*B)

### FIXED CODE ###

A, B = map(int,input().split())
print(max(A + B, A- B, A*B))
# coding: utf-8
# Your code here!
#動的計画法

N = int(input())
Ni_2 = 2
Ni_1 = 1

for i in range(2, N + 1):
    Ni = Ni_1 + Ni_2
    Ni_2 = Ni_1
    Ni_1 = Ni
print(Ni)


### FIXED CODE ###

# coding: utf-8
# Your code here!
#動的計画法

N = int(input())
Ni_2 = 2
Ni_1 = 1
Ni = 1
Ni_dummy = 0

for i in range(2, N + 1):
    Ni = Ni_1 + Ni_2
    Ni_2 = Ni_1
    Ni_1 = Ni
print(Ni)
import sys

TO_K = []
TREE = []
DISTANCE = []

def dfs(child, parent):
    small, big = min(child, parent), max(child, parent)
    for i_distance in DISTANCE[small]:
        if i_distance[0] == big:
            TO_K[child] = TO_K[parent] + i_distance[1]

    for i_gch in TREE[child]:
        if i_gch == parent:
            continue
        dfs(i_gch, child)

    return


def main():
    n = int(input())
    abc = [[int(_) for _ in input().split()] for i in range(n-1)]
    q, k = map(int, input().split())
    xy = [[int(_) for _ in input().split()] for i in range(q)]

    global TO_K
    # index '0' is not used.
    TO_K = [0]*(n+1)

    global TREE
    global DISTANCE
    # index '0' is not used.
    TREE = [[] for _ in range(n+1)]
    DISTANCE = [[] for _ in range(n+1)]
    for a, b, c in abc:
        TREE[a].append(b)
        TREE[b].append(a)
        small, big = min(a,b), max(a, b)
        DISTANCE[small].append([big, c])

    dfs(k, 0)

    for x, y in xy:
        print(TO_K[x]+TO_K[y])
    return


if __name__ == "__main__":
    main()
    sys.exit(0)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

TO_K = []
TREE = []

def dfs(parent, distance):
    for i_node in TREE[parent]:
        child, dd = i_node
        if TO_K[child] != -1:
            continue

        next_dt = distance + dd
        TO_K[child] = next_dt
        dfs(child, next_dt)

    return


def main():
    n = int(input())
    abc = [[int(_) for _ in input().split()] for i in range(n-1)]
    q, k = map(int, input().split())
    xy = [[int(_) for _ in input().split()] for i in range(q)]

    global TO_K
    # index '0' is not used.
    TO_K = [-1]*(n+1)

    global TREE
    # index '0' is not used.
    TREE = [[] for _ in range(n+1)]
    for a, b, c in abc:
        TREE[a].append([b, c])
        TREE[b].append([a, c])

    TO_K[k] = 0
    dfs(k, 0)

    for x, y in xy:
        print(TO_K[x]+TO_K[y])
    return


if __name__ == "__main__":
    main()
    sys.exit(0)
a, b, c = map(int, input().split())
print('YES' if a - 2b + c == 0 else 'NO')


### FIXED CODE ###

a, b, c = map(int, input().split())
print('YES' if a - 2*b + c == 0 else 'NO')
N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]

B=[0]*N
# from functools import lru_cache
# @lru_cache(maxsize=1000)
# def yapoos()
for i in A:
    if H[i[0]]>H[i[1]]:
        B[i[0]]=1
    elif H[i[0]]<H[i[1]]:
        B[i[i]]=1
print(B.count(0))

### FIXED CODE ###

N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]

B=[0]*N
# from functools import lru_cache
# @lru_cache(maxsize=1000)
# def yapoos()
for i in A:
    if H[i[0]-1]>H[i[1]-1]:
        B[i[1]-1]=1
    elif H[i[0]-1]<H[i[1]-1]:
        B[i[0]-1]=1
    else:
        B[i[0]-1]=1
        B[i[1]-1]=1
print(B.count(0))
A,B=input().split()
B=list(B)
N=B[0]+B[2]+B[3]
N=int(N)
C=int(A*N/100)
print(C)

### FIXED CODE ###

A,B=input().split()
A=int(A)
B=list(B)
N=B[0]+B[2]+B[3]
N=int(N)
C=int(A*N//100)
print(C)
import heapq
n,m=map(int,input().split())
edge = [[] for i in range(n*3)]
#edge[i] : iから出る道の[行先]の配列
for i in range(m):
    x,y = map(int,input().split())
    x-=1;y-=1
    x*=3;y*=3
    edge[x  ].append(y+1)
    edge[x+1].append(y+2)
    edge[x+2].append(y  )
    
def dfs(s,g,res):
  #print(s,g,res)
  if s==g or s==g+1 or s==g+2:
    if res%3==0:
      return res//3
  
  if res>n+m:
    return float("inf")
  
  if edge[s]==[]:
    return float("inf")
  
  l=float("inf")
  for i in edge[s]:
    l=min(l,dfs(i,g,res+1))
  return l

s,t=map(int,input().split())
s-=1;t-=1
ans=dfs(s*3,t*3,0)
if ans==float("inf"):
  print(-1)
else:
  print(ans)


### FIXED CODE ###

from collections import deque
n,m=map(int,input().split())
edge = [[] for i in range(n+1)]
#edge[i] : iから出る道の[行先]の配列
for _ in range(m):
    u, v = map(int, input().split())
    edge[u].append(v)
s,t = map(int, input().split())
queue = deque()
queue.append((s, 0))
visited = [[False] * 3 for _ in range(n+1)]
while queue:
    u, d = queue.popleft()
    if visited[u][d % 3]:
        continue
    visited[u][d % 3] = True
    if d % 3 == 0 and u == t:
        print(d // 3);exit()
    for v in edge[u]:
        queue.append((v, d+1))
print(-1)
from sys import stdin
n, m = map(int, stdin.readline().split())
edges = [set() for _ in range(n)]
for _ in [0] * m:
    s, t = map(int, stdin.readline().split())
    edges[s].add(t)
    edges[t].add(s)
prenum = [None] * n
parent = [None] * n
lowest = [None] * n
counter = 0
def dfs(cur, prev):
    global counter
    prenum[cur] = lowest[cur] = counter
    counter += 1
    for edge in edges[cur]:
        if prenum[edge] is not None:
            if edge != prev:
                lowest[cur] = min(lowest[cur], prenum[edge])
            continue
        parent[edge] = cur
        dfs(edge, cur)
        lowest[cur] = min(lowest[cur], lowest[edge])
dfs(0, 1)
ap = [False] * n
r = 0
for _ in filter(lambda x: x == 0, parent):
    r += 1
    if r > 1:
        ap[0] = True
        break
for i in range(1, n):
    p = parent[i]
    if p and prenum[p] <= lowest[i]:
        ap[p] = True
for i, e in enumerate(ap):
    if e: print(i)

### FIXED CODE ###

from sys import stdin
import sys
from math import isinf
INF = float("inf")
sys.setrecursionlimit(100000)
def dfs(v, tm):
    dts[v] = est[v] = tm + 1
    child = 0
    for i in adj[v]:
        if est[i] == float('inf'):
            child += 1
            parents[i] = v
            dfs(i, tm + 1)
            est[v] = min(est[v], est[i])
            if parents[v] is None and child > 1: aps[v] = True
            if parents[v] is not None and est[i] >= dts[v]: aps[v] = True
        elif parents[v] != i:
            est[v] = min(est[v], dts[i])
n, m = map(int, stdin.readline().split())
adj = [[] for _ in range(n)]
est = [float('inf')] * n
parents = [None] * n
aps = [False] * n
dts = [0] * n
for _ in range(m):
    s, t = map(int, stdin.readline().split())
    adj[s].append(t)
    adj[t].append(s)
dfs(0, 0)
for i in range(n):
    if aps[i]:
        print(i)
def main():
    N = int(input())
    A = []
    for i in range(N):
        A.append(int(input()))
    C = [A[i] - i - 1 for i in range(N)]
    C.sort()
    m = N // 2
    x = C[m]
    left = sum([x - C[i] for i in range(m)])
    right = sum([C[i] - x for i in range(m + 1, N)])
    print(left + right)
    
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N = int(input())
    A = []
    data = input().split()
    for i in range(N):
        A.append(int(data[i]))
    C = [A[i] - i - 1 for i in range(N)]
    C.sort()
    m = N // 2
    x = C[m]
    left = sum([x - C[i] for i in range(m)])
    right = sum([C[i] - x for i in range(m + 1, N)])
    print(left + right)
    
if __name__ == "__main__":
    main()
import math
def lcm(x,y):
    return (x*y)//math.gcd(x,y)

a,b,c,d = map(int,input().split())
print((b-a+1)-b//c-b//d+b//lcm(c,d)+(a-1)//d+(a-1)//c-(a-1)//lcm(c,d))

### FIXED CODE ###

import fractions
def lcm(x,y):
    return (x*y)//fractions.gcd(x,y)

a,b,c,d = map(int,input().split())
print((b-a+1)-b//c-b//d+b//lcm(c,d)+(a-1)//d+(a-1)//c-(a-1)//lcm(c,d))