Harryxun/stf_run huggingface dataset:
n, p = map(int, input().split())

b = [False] * 1000001
prime = []
b[1] = True

for i in range(2, 1000001):
    if b[i]:
        continue
    k = i + i
    while k < 1000001:
        b[k] = True
        k += i

    prime.append(i)

prime_num = [0] * len(prime)

pp = []

for i in range(len(prime)):
    while p % prime[i] == 0:
        pp.append(prime[i])
        prime_num[i] += 1
        p //= prime[i]

if len(pp) == 0:
    print(1)
    exit()

idx = []
for i in range(len(prime) - 1, -1, -1):
    if prime_num[i] >= n:
        idx.append(i)
        break

for i in range(idx[0] - 1, -1, -1):
    if prime_num[i] >= prime_num[idx[0]]:
        idx.append(i)

ans = 1
for x in idx:
    ans *= prime[x]

print(ans)

### FIXED CODE ###

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

if n == 1:
    print(p)
    exit()

b = [False] * 1000001
prime = []
b[1] = True

for i in range(2, 1000001):
    if b[i]:
        continue
    k = i + i
    while k < 1000001:
        b[k] = True
        k += i

    prime.append(i)

prime_num = [0] * len(prime)

for i in range(len(prime)):
    while p % prime[i] == 0:
        prime_num[i] += 1
        p //= prime[i]

if sum(prime_num) == 0:
    print(1)
    exit()

idx = []
for i in range(len(prime) - 1, -1, -1):
    if prime_num[i] >= n:
        idx.append(i)

if len(idx) == 0:
    print(1)
    exit()

ans = 1
for x in idx:
    a = prime_num[x] // n
    ans *= prime[x] ** a

print(ans)
a=["SUN","MON","TUE","WED","THU","FRI","SAT"]
s=input()
print(7-a.index(str))

### FIXED CODE ###

a={'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1}
print(a[input()])
import collections
import itertools
N, M = list(map(int, input().split()))
ABs = [list(map(int, input().split())) for _ in range(M)]

ans_list = [0] * (N+1)

dq = collections.deque()

dq.append(1)

for hoge in range(500000)
    i = dq.popleft()
    iList = [temp for temp in ABs if i in temp]

    iList = list(itertools.chain.from_iterable(iList))
    iList = [temp for temp in iList if iList !=i]

    for hoge in iList:
        if(ans_list[hoge] == 0):
            ans_list[hoge] = i
        dq.append(hoge)

    if(0 not in ans_list[2:]):
        break

for ans in ans_list[2:]:
    print(ans)    



### FIXED CODE ###

import collections
import itertools
N, M = list(map(int, input().split()))
ABs = [list(map(int, input().split())) for _ in range(M)]

loads = [[] for _ in range(N+1)]

for AB in ABs:
    loads[AB[0]].append(AB[1])
    loads[AB[1]].append(AB[0])


dq = collections.deque()

dq.append(1)
ans_list = [0 for _ in range(N+1)]

#print(loads)
print("Yes")
while len(dq) != 0:
    i = dq.popleft()

    for vec in loads[i]:
#        print(vec)
        if(ans_list[vec] == 0):
            ans_list[vec] = i
            dq.append(vec)
#        print(ans_list)
#        print(dq)


for ans in ans_list[2:]:
    print(ans)
a, b = map(int, input().split())
print(a//gcd(a, b)*b)


def gcd(a, b):
    if not b:
        return a
    return gcd(b, a % b)


### FIXED CODE ###

def gcd(a, b):
    if not b:
        return a
    return gcd(b, a % b)

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

for a in range(1000):
    for b range(1000):
        if a ** 5 - b ** 5 == x:
            print(a,b)
            exit()
            


### FIXED CODE ###

x = int(input())

for a in range(-1000,1000):
    for b in range(-1000,1000):
        if a ** 5 - b ** 5 == x:
            print(a,b)
            exit()
a,b=map(int,input().split())
if b==1:
    print(0)
elif a<b:
    print(b//a+1)
elif a=b:
    print(b//a)
else:
    print(1)

### FIXED CODE ###

a,b=map(int,input().split())
if b==1:
    print(0)
elif a<b:
    x=(b-1)//(a-1)
    if (b-1)%(a-1)==0:
        print(x)
    else:
        print(x+1)
else:
    print(1)
a = int(input())
b = int(input())
c = a+b
d = 1
while(int(c/10) != 0):
	d += 1
	c /= 10
print(d)


### FIXED CODE ###

import sys
for line in sys.stdin:
	l=0
	for l in range(len(line)):
		if(line[l] == ' '):
			p = l
			break
	a = line[0:p]
	b = line[p+1:]
	c = int(a)+int(b)
	d = 1
	while(int(c/10) != 0):
		d += 1
		c = int(c/10)
	print(d)
a, b, c = map(int,input().split())

if a == 5 and b == 5 and c == 7:
  print(YES)

elif a == 5 and b == 7 and c == 5:
  print(YES)

elif a == 7 and b == 5 and c == 5:
  print(YES)

else:
  print(NO)
  

### FIXED CODE ###

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

if a == 5 and b == 5 and c == 7:
  print('YES')

elif a == 5 and b == 7 and c == 5:
  print('YES')

elif a == 7 and b == 5 and c == 5:
  print('YES')

else:
  print('NO')
a=int(input())
b=int(input())
print(a*b (a+b)2)


### FIXED CODE ###

a,b = map(int, input().split())
print(a*b, 2*(a+b))
def dfs(x, d, s):
    for y in V[x]:
        if d[y]:
            s += f[y]
            cnt[y] = s
            d[y] = 0
            dfs(y, d, s)
            s -= f[y]


N, Q = map(int, input().split())  # N頂点, Q個の操作
V = [[] for i in range(N)]  # グラフの情報を格納する
for i in range(N-1):  # 辺の個数はN-1個
    a, b = map(lambda x: int(x)-1, input().split())
    V[a].append(b)
    V[b].append(a)

f = [0]*N

for i in range(Q):  # Q個の操作についての情報
    p, x = map(int, input().split())
    p -= 1
    f[p] += x  # 頂点pをルートにもつ部分技にはxが足されていく

cnt = [0]*N  # 各頂点のカウンター

d = [1]*N
d[0] = 0

cnt[0] = f[0]  # ルートに足される値は確定している

s = f[0]
dfs(0, d, s)
print(" ".join(map(str, cnt)))


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a = I()
    s = input()
    if a >= 3200:
        print(s)
    else:
        print("red")
    return

#B
def B():
    n = I()
    a = LI()
    ans = 0
    for i in a:
        ans += 1/i
    print(1/ans)
    return

#C
def C():
    n = I()
    v = LI()
    q = []
    for i in v:
        heappush(q,i)
    while q:
        x = heappop(q)
        if not q:
            print(x)
            return
        y = heappop(q)
        heappush(q,(x+y)/2)
    return

#D
def D():
    def dfs(x,d,s):
        for y in v[x]:
            if d[y]:
                s += f[y]
                ans[y] = s
                d[y] = 0
                dfs(y,d,s)
                s -= f[y]
    n,q = LI()
    v = [[] for i in range(n)]
    for i in range(n-1):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v[b].append(a)
    f = [0]*n
    for i in range(q):
        p,x = LI()
        p -= 1
        f[p] += x
    ans = [0]*n
    d = [1]*n
    d[0] = 0
    ans[0] = f[0]
    s = f[0]
    dfs(0,d,s)
    print(*ans)
    return

#E
def E():
    s = input()
    t = input()

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    D()
n, q = map(int, input().split(' '))
inf = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split(' '))
    inf[a-1].append(b-1)
    inf[b-1].append(a-1)
score = [0 for _ in range(n)]
visit = [0 for _ in range(n)]
for _ in range(q):
    p, x = map(int, input().split(' '))
    score[p-1] += x
def addp(num):
    if visit[inf[num][0]] == 1 and len(inf[num]) == 1:
        return 0
    visit[num] = 1
    for i in inf[num]:
        if visit[i] == 1:
            continue
        else:
            score[i] += score[num]
            addp(i)
    return 0
addp(0)
print(*score)

### FIXED CODE ###

def main():
    n, q = map(int, input().split(' '))
    import sys
    from collections import deque
    sys.setrecursionlimit(10**7)

    visit = [True for _ in range(n)]
    point = [0 for _ in range(n)]
    dic = [[] for _ in range(n)]
    for _ in range(n-1):
        a, b = map(int, input().split(' '))
        dic[a-1].append(b-1)
        dic[b-1].append(a-1)
    for _ in range(q):
        p, x = map(int, input().split(' '))
        point[p-1] += x
    next_visit = deque()
    next_visit.append(0)
    visit[0] = False
    counter = 1
    while counter < n:
        t = next_visit.pop()
        for s in dic[t]:
            if visit[s]:
                point[s] += point[t]
                visit[s] = False
                counter += 1
                next_visit.append(s)
    print(*point)
if __name__ == '__main__':
    main()
# coding: utf-8
a=input()
b=a.split(" ")
A=b[0]
B=b[1]
C=A+B
print(b)
if C%3==0:
    print("Possible")
else:
    print("Impossible")


### FIXED CODE ###

# coding: utf-8
# Here your code !
a=input()
b=a.split(" ")
A=int(b[0])
B=int(b[1])

C=A+B
if C%3==0 or A%3==0 or B%3==0:
    print("Possible")
else:
    print("Impossible")
input_num = raw_input()

print input_num**3

### FIXED CODE ###

num = input()

print num**3
a = float(input())
b = float(input())
c = a * b
ans = int(c//1)
print(ans)

### FIXED CODE ###

a, b = input().split()

c = int(a)
d = int(float(b) * 1000)

e = c * d

ans = e // 1000
print(ans)
l = input("Enter: ")
print("Yes" if (l[2]==l[3] and l[4]==l[5] else "No"))

### FIXED CODE ###

l = input()
print("Yes" if (l[2]==l[3] and l[4]==l[5]) else "No")
a

### FIXED CODE ###

import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=998244353
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

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

N = 10**5*2+100
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=m*pow(m-1,n-1,mod)
ans%=mod
# print(ans)
for i in range(k):
    tmp=cmb(n-1,i+1)*m*pow(m-1,n-(i+2),mod)
    # print(cmb(n-1,i+1),m,pow(m-1,n-(i+1),mod))
    # print(tmp)
    tmp%=mod
    ans+=tmp
    ans%=mod
    # print(ans,tmp)
print(ans)
# coding: utf-8
S = input().split()
Q = int(input())

def pop(left, right, rev, f, c):
    if rev == 1:
        if f == '1':
            left_ = [c] + left
        else:
            right.append(c)
    else:
        if f == '1':
            right.append(c)
        else:
            left_ = [c] + left
    return left_, right


left, right = [], []
rev = 1
for _ in range(Q):
    que = input().split()
    if que[0] == '1':
        rev *= -1
        continue
    if que[0] == '2':
        left, right = pop(left, right, rev, *que[1:])
print(''.join(left+S+right)[::rev])

### FIXED CODE ###

# coding: utf-8
S = input().split()
Q = int(input())

def pop(left, right, rev, f, c):
    if rev == 1:
        if f == '1':
            left.append(c)
        else:
            right.append(c)
    else:
        if f == '1':
            right.append(c)
        else:
            left.append(c)
    return left, right


left, right = [], []
rev = 1
for _ in range(Q):
    que = input().split()
    if que[0] == '1':
        rev *= -1
        continue
    if que[0] == '2':
        left, right = pop(left, right, rev, *que[1:])
print(''.join(left[::-1]+S+right)[::rev])
a = input()
s = input()
if s[0]>3199:
        print(s[1])
else:
        print ("red")     

### FIXED CODE ###

a = int(input())
s = input()
if a>=3200:print(s)
else:print("red")
n,k=map(int,input().split())
mod=10**9+7
root=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    root[a-1].append(b-1)
    root[b-1].append(a-1)
def perm(k,n):
    x=1
    if k-n+1<=0:
        return 0
    for i in range(k,k-n,-1):
        x=x*i%mod
    return x
def dfs(node,depth,prev): 
    l=len(root[node])
    d=depth
    x=1
    if l==0:
        return 1
    if l==1 and depth>1:
        return 1
    if depth>1:
        x=perm(k-d,l-1)
    else:
        x=perm(k-d,l)
    for y in root[node]:
        if y!=prev:
            x=x*dfs(y,2,node)%mod
    return x%mod
count=dfs(0,1,0)*k%mod
print(count if count>0 else 0)

### FIXED CODE ###

n,k=map(int,input().split())
mod=10**9+7
import sys
sys.setrecursionlimit(10**9)
root=[[] for i in range(n)]
for i in range(n-1):
    a,b=map(int,input().split())
    root[a-1].append(b-1)
    root[b-1].append(a-1)
def perm(k,n):
    x=1
    if k-n+1<=0:
        return 0
    for i in range(k,k-n,-1):
        x=x*i%mod
    return x
def dfs(node,depth,prev): 
    l=len(root[node])
    d=depth
    x=1
    if l==0:
        return 1
    if l==1 and depth>1:
        return 1
    if depth>1:
        x=perm(k-d,l-1)
    else:
        x=perm(k-d,l)
    for y in root[node]:
        if y!=prev:
            x=x*dfs(y,2,node)%mod
    return x%mod
count=dfs(0,1,0)*k%mod
print(count if count>0 else 0)
s=input()
a={}
ans="yes"
for i in range(len(s)):
  if s[i] in a:
    ans="no"
    break
  a+={s[i]}
print(ans)

### FIXED CODE ###

s=input()
a=set()
ans="yes"
for i in range(len(s)):
  if s[i] in a:
    ans="no"
    break
  a.add(s[i])
print(ans)
from sys import stdin, stdout  

X,Y,A,B,C = [int(c) for c in input().split()]

p= [int(c) for c in input().split()]
q= [int(c) for c in input().split()]
r= [int(c) for c in input().split()]

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p=p[:X]
q=q[:Y]
    
p.sort()
q.sort()
res=sum(p)+sum(q)

i=j=0

for k,val in enumerate(r):
    if(i<len(p) and j<len(q)):
        if(val<=p[i] and val <= q[j]):
            break
        if(val>p[i] and val<q[j]):
            res=res+val-p[i]
            i=i+1
        if(val<p[i] and val>q[j]):
            res=res+val-q[j]
            j=j+1
        if(val>p[i] and val>q[j]):
            if(p[i]>q[j]):
                res=res+val-q[j]
                j=j+1
            else:
                res=res+val-p[i]
                i=i+1
    if(i<len(p) and j==len(q)):
        if(val<=p[i]):
            break
        if(val>p[i]):
            res=res+val-p[i]
            i=i+1
    if(i==len(p) and j<len(q)):
        if(val<=q[j]):
            break
        if(val>q[j]):
            res=res+val-q[j]
            j=j+1
    if(i==len(p) and j==len(q)):
        break
        
print(res)

### FIXED CODE ###

from sys import stdin, stdout  

X,Y,A,B,C = [int(c) for c in input().split()]

p= [int(c) for c in input().split()]
q= [int(c) for c in input().split()]
r= [int(c) for c in input().split()]

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p=p[:X]
q=q[:Y]
    
p.sort()
q.sort()
res=sum(p)+sum(q)

i=j=0

for k,val in enumerate(r):
    if(i<len(p) and j<len(q)):
        if(val<=p[i] and val <= q[j]):
            break
        elif(val>p[i] and val<q[j]):
            res=res+val-p[i]
            i=i+1
        elif(val<p[i] and val>q[j]):
            res=res+val-q[j]
            j=j+1
        elif(val>p[i] and val>q[j]):
            if(p[i]>q[j]):
                res=res+val-q[j]
                j=j+1
            else:
                res=res+val-p[i]
                i=i+1
    elif(i<len(p) and j==len(q)):
        if(val<=p[i]):
            break
        elif(val>p[i]):
            res=res+val-p[i]
            i=i+1
    elif(i==len(p) and j<len(q)):
        if(val<=q[j]):
            break
        elif(val>q[j]):
            res=res+val-q[j]
            j=j+1
    elif(i==len(p) and j==len(q)):
        break
        
print(res)
import numpy as np

a, b, x = map(int,input().split())
c = b-(x/a**2)
d = a*b

if c <= b//2:
    print(np.degrees(np.arctan2(b-(x / a**2),a/2)))

else:
    print(np.degrees(np.arctan2(x / d),b))

### FIXED CODE ###

import numpy as np

a, b, x = map(int,input().split())
c = b-(x/a**2)
d = (a*b)/2

if c <= b/2:
    print(np.degrees(np.arctan2(c,a/2)))
    
else:
    print(np.degrees(np.arctan2(b,(x/d))))
import sys
import itertools
import numpy as np

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N = int(readline())
A = [[int(x) - 1 for x in row.split()] for row in readlines()]


ids = [[0 for j in range(N)] for i in range(N)]
V = 0
for i in range(N):
    for j in range(N):
        ids[i][j] = V
        V += 1

MAXV = 1005 * 1005 // 2

visited = [False for i in range(MAXV)]
calculated = [False for i in range(MAXV)]
dp = [0 for i in range(MAXV)]

def dfs(v):
    if visited[v]:
        if not calculated[v]:
            print(-1)
            exit()

        return dp[v]

    visited[v] = True
    dp[v] = 1
    for u in to[v]:
        dp[v] = max(dp[v], dfs(u) + 1)

    calculated[v] = True
    return dp[v]

to = [[] for i in range(MAXV)]
for i in range(N):
    for j in range(N - 1):
        a = i
        b = A[i][j]
        if a > b:
            a, b = b, a
        A[i][j] = ids[a][b]
    for j in range(N - 2):
        to[A[i][j + 1]].append(A[i][j])

ans = 0
for i in range(V):
    ans = max(ans, dfs(i))

print(ans)

### FIXED CODE ###

import sys
import itertools
import numpy as np

from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N = int(readline())
A = [[-1] + [int(x) - 1 for x in row.split()][::-1] for row in readlines()]

# A.append([-1])

def f(cand):
    cand1 = set()
    can_use = []
    for n in cand:
        if A[A[n][-1]][-1] == n:
            can_use.append(n)
    for n in can_use:
        A[n].pop()
        cand1.add(n)
        if A[n][-1] != -1:
            cand1.add(A[n][-1])
    return len(can_use), cand1

answer = 0
rest = N*(N-1)
cand = set(range(N))
while True:
    answer += 1
    x, cand = f(cand)
    if x == 0:
        answer = -1
        break
    rest -= x
    if rest == 0:
        break

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

ans = 0
for get in range(K+1):
    put = K - get
    for right in range(get+1):
        left = get - right
        jewels = A[:right] + A[N-left:]
        jewels.sort()
        value = sum(jewels)
        for i in range(get):
            if i + 1 > put:
                break
            if jewels[i] < 0:
                value += abs(jewels[i])
            else:
                break
        ans = max(ans, value)
print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
jewels = list(map(int, input().split())) + [0]
ans = 0
for get in range(1, min(N, K)+1):
  put = min(get, K-get)
  for left in range(get+1):
    right = get - left
    values = jewels[:left] + jewels[N-right:]
    sum_v = sum(values)
    minus_values = list(filter(lambda x: x<0, values))
    minus_values.sort()
    cnt = 0
    for v in minus_values:
      if cnt < put:
        sum_v -= v
        cnt += 1
      else:
          break
    ans = max(ans, sum_v)
print(ans)
count = 0
while true:
    count += 1
    a = int(input())
    if a == 0:
        break
    print("Case {}: {}".format(count, a))


### FIXED CODE ###

count = 0
while True:
    count += 1
    a = int(input())
    if a == 0:
        break
    print("Case {}: {}".format(count, a))
n,k=map(int,input(),split())
print(n-k+1)

### FIXED CODE ###

n,k=map(int,input().split())
print(n-k+1)
# coding: utf-8

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

num = [-1] * (N + 1)
fin = 0
for _ in range(M):
    s, c = map(int, input().split())
    if num[s] == -1:
        num[s] = c
    elif num[s] != c:
        fin = 1
        print(-1)
        break
if N == 1 and sum[1] == 0:
    print(0)
    fin = 1
if fin == 0:
    for i in range(1, N + 1):
        if i == 1:
            if num[i] == -1:
                print(1, end="")
            elif num[i] == 0:
                print(-1)
                break
            else:
                print(num[i], end="")
        else:
            if num[i] == -1:
                print(0, end="")
            else:
                print(num[i], end="")

### FIXED CODE ###

# coding: utf-8
import sys

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

if M == 0:
    if N == 1:
        print(0)
        sys.exit()
    else:
        print(10 ** (N - 1))
        sys.exit()

num = [-1] * (N + 1)
fin = 0
for _ in range(M):
    s, c = map(int, input().split())
    if num[s] == -1:
        num[s] = c
    elif num[s] != c:
        fin = 1
        print(-1)
        break

if fin == 0:
    for i in range(1, N + 1):
        if i == 1:
            if num[i] == -1:
                print(1, end="")
            elif num[i] == 0 and N == 1:
                print(0)
            elif num[i] == 0:
                print(-1)
                break
            else:
                print(num[i], end="")
        else:
            if num[i] == -1:
                print(0, end="")
            else:
                print(num[i], end="")
n,m=map(int,input())
for i in range(h):
  s=list(input().split())
  for j in range(w):
    if s[j]=='snuke':
      print(chr(97+j)+str(i+1))


### FIXED CODE ###

h,w=map(int,input().split())
for i in range(h):
  s=list(input().split())
  for j in range(w):
    if s[j]=='snuke':
      print(chr(65+j)+str(i+1))
N=list(input().split)

n=reversed(N)

if n[0]=="2" or n[0]=="4" or n[0]=="5" or n[0]=="7" or n[0]=="9":
    print("hon")
if n[0]=="0" or n[0]=="1" or n[0]=="6" or n[0]=="8":
    print("pon")
if n[0]=="3":
    print("bon")


### FIXED CODE ###

n=list(input())

n==n.reverse()

if (n[0]=="2" or n[0]=="4" or n[0]=="5" or n[0]=="7" or n[0]=="9"):
    print("hon")
elif (n[0]=="0" or n[0]=="1" or n[0]=="6" or n[0]=="8"):
    print("pon")
elif (n[0]=="3"):
    print("bon")
import numpy as np

k = input()
sum = 0
for p in range(k):
    for q in range(k):
        for r in range(k):
            sum += np.gcd.reduce([i,j,k])

print(sum)

### FIXED CODE ###

import math

k = int(input())
sum = 0
gcds = [[0 for i in range(k)] for i in range(k)]
for p in range(1,k+1):
    for q in range(1,k+1):   
        gcds[p-1][q-1] = math.gcd(p,q)          
        for r in range(1,k+1):
            sum += math.gcd(gcds[p-1][q-1], r)
            


print(sum)
def main():
    n, q = map(int, input().split())
    g = [[] for _ in range(n)]
    for _ in range(n-1):
        a, b = map(lambda x: int(x)-1, input().split())
        g[a].append(b); g[b].append(a)
    node = [0]*n
    for i in range(q):
        p, x = map(int, input().split())
        p -= 1
        node[p] += x

    def dfs(v, p=-1):
        for u in g[v]:
            if u==p:
                continue
            node[u] += node[v]
            dfs(u, v)
    dfs(0)
    print(*node)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

n, q = map(int, input().split())
g = [list() for i in range(n)]
node = [0] * n

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

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

def dfs(v, p=-1):
    for u in g[v]:
        if u == p: continue
        node[u] += node[v]
        dfs(u, v)

dfs(0)
print(*node)
n, x = (int(i) for i in input().split())
l = [int(i) for i in input().split()]

d = 0
ans = 0
i = 0
while d <= x:
    ans += 1
    d = d + l[i]
    i += 1

print(ans)

### FIXED CODE ###

n, x = (int(i) for i in input().split())
l = [0] + [int(i) for i in input().split()]

d = 0
ans = 0
i = 1
while d <= x:
    ans += 1
    if ans == n+1:
        break
    d = d + l[i]
    i += 1

print(ans)
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
list = []

for i in range(n):
    list.append(s.count(t[i]))

ans = 1

for i in range(len(list)):
    ans *= (list[i]+1)
    if ans > 10**9 + 7:
        ans = ans % (10**9+7)

print(ans-1)

### FIXED CODE ###

n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(26):
    ans *= (s.count(t[i]) + 1)

print((ans-1)%(10**9+7))