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

nc=0
mc=0
if n >=2:
    nc=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
if m>=2:
    mc=math.factorial(m) // (math.factorial(m - 2) * math.factorial(2))

print(nc+mc)


### FIXED CODE ###

import math

def resolve():

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

    nc=0
    mc=0
    if n >=2:
        nc=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
    if m>=2:
        mc=math.factorial(m) // (math.factorial(m - 2) * math.factorial(2))

    print(nc+mc)

resolve()
N = int(input())
items = []
count = 0
for x in range(N):
  thing = input()
  if thing is not in items:
    count += 1
  items.append(thing)
print(count)

### FIXED CODE ###

N = int(input())
arr = []
for x in range(N):
  arr.append(input())

print(len(list(set(arr))))
n=int(input())
a=list(map(int,input().split()))

for i in range(n):
    if a[0]<a[i]:
        up=True
        nin=a[0]
        break
    elif a[0]>a[i]:
        up=False
        break
    if i==n-1:
        print(1000)
        exit()

total=1000

for i in range(1,n-1):
    if up:
        if a[i-1]<=a[i] and a[i]>a[i+1]:
            total+=(total//nin)*(a[i]-nin)
            up=False
    else:
        if a[i-1]>=a[i] and a[i]<a[i+1]:
            nin=a[i]
            up=True
if nin<a[n-1]:
    total+=(total//nin)*(a[n-1]-nin)
print(total)

### FIXED CODE ###

x=int(input())

if 400<=x and x<=599:
    print(8)
elif 600<=x and x<=799:
    print(7)
elif 800<=x and x<=999:
    print(6)
elif 1000<=x and x<=1199:
    print(5)
elif 1200<=x and x<=1399:
    print(4)
elif 1400<=x and x<=1599:
    print(3)
elif 1600<=x and x<=1799:
    print(2)
elif 1800<=x and x<=1999:
    print(1)
n = int(input())
a = list(map(int,input().split()))

for i in range(100):
    if max_num < a[i]:
        max_num = a[i]
    elif min_num > a[i]:
        min_num =a[i]

print(max_num-min_num)

### FIXED CODE ###

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

print(max(a)-min(a))
lists = []
for i in range(5):
	lists.append(input())

f_list = []
for i in lists:
	f_list.append(i[-1])

mins = 0
if not "0" in f_list:
    mins = int(min(f_list))
else:
    mins = int(sorted(set(f_list))[1])
sums = 0
for i in lists:
	sums += int((int(i)+9)/10)*10


print(sums-10+mins)

### FIXED CODE ###

lists = []
for i in range(5):
	lists.append(input())

f_list = []
for i in lists:
	f_list.append(i[-1])

mins = 10
if not "0" in f_list:
    mins = int(min(f_list))
elif len(set(f_list)) == 1:
    pass
else:
    mins = int(sorted(set(f_list))[1])
sums = 0
for i in lists:
	sums += int((int(i)+9)/10)*10


print(sums-10+mins)
from collections import defaultdict, deque
def sub():

    N, M = [int(e) for e in input().split()]
    es = [[int(x) for x in input().split()] for _ in range(N)]

    outs = defaultdict(list)
    ins = defaultdict(int)
    for v1, v2 in es:
        outs[v1].append(v2)
        ins[v2] += 1

    q = deque(v1 for v1 in range(v) if ins[v1] == 0)
    dp_table = [0 for i in range(N+1)]
    res = []
    while q:
        v1 = q.popleft()
        res.append(v1)
        for v2 in outs[v1]:
            ins[v2] -= 1
            if ins[v2] == 0:
                q.append(v2)
                dp_table[v2] = max(dp_table[v2], dp_table[v1] + 1)
    print(max(dp_table))

if __name__ == "__main__":
    sub()


### FIXED CODE ###

from collections import defaultdict, deque
def sub():

    N, M = [int(e) for e in input().split()]
    es = [[int(x) for x in input().split()] for _ in range(M)]

    outs = defaultdict(list)
    ins = defaultdict(int)
    for v1, v2 in es:
        outs[v1].append(v2)
        ins[v2] += 1

    q = deque(v1 for v1 in range(1, N+1) if ins[v1] == 0)
    dp_table = [0 for i in range(N+1)]
    res = []
    while q:
        v1 = q.popleft()
        res.append(v1)
        for v2 in outs[v1]:
            ins[v2] -= 1
            if ins[v2] == 0:
                q.append(v2)
                dp_table[v2] = max(dp_table[v2], dp_table[v1] + 1)
    print(max(dp_table))

if __name__ == "__main__":
    sub()
a, b, c =map(int,input().split())
if a == b and a != c:
    print("Yes")
elif a == c and a != b:
    print("Yes")
elif b == c and a != b:
    peint("Yes")
else:
    print("No")

### FIXED CODE ###

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

if a == b and a != c:
    print('Yes')
elif a == c and a != b:
    print('Yes')
elif b == c and a != b:
    print('Yes')
else:
    print('No')
# ABC064
# C
# Colorful Leaderboard

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

color_list = [0]*8
over = 0
for i in range(n):
    _ = a_list[i] // 400
    if _ < 8:
        color_list[_] = 1
    else:
        over += 1

_tmp = sum(color_list)
if _tmp == 0:
    print("1 %d"%_over)
else:
    print("%d %d"%(_tmp, _tmp+over))

### FIXED CODE ###

# ABC064
# C
# Colorful Leaderboard

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

color_list = [0]*8
over = 0
for i in range(n):
    _ = a_list[i] // 400
    if _ < 8:
        color_list[_] = 1
    else:
        over += 1

_tmp = sum(color_list)
if _tmp == 0:
    print("1 %d"%over)
else:
    print("%d %d"%(_tmp, _tmp+over))
n = int(input())
val = []
for i in map(int, input().split()):
    i.append(val)
cost = []
for i in map(int, input().split()):
    i.append(cost)

x = 0
y = 0
m1 = 0
for i in range(n):
    x += val[i]
    y += cost[i]
    m2 = x-y
    if m1 < m2:
        m1 = m2

print(m2)


### FIXED CODE ###

n = int(input())
val = []
for i in map(int, input().split()):
    val.append(i)
cost = []
for i in map(int, input().split()):
    cost.append(i)

ans = 0
for i in range(n):
    m = val[i] - cost[i]
    if m > 0:
        ans += m

print(ans)
def main():
    n = int(input())
    ans = n * (n + 1) * (n + 2) // 6
    
    for i in range(n):
        x, y = map(int, input().split())
        if x > y:
            y, x = x, y
        ans -= x * (n - y + 1)
    print(ans)
    
main()

### FIXED CODE ###

def main():
    n = int(input())
    ans = n * (n + 1) * (n + 2) // 6
    
    for i in range(n-1):
        x, y = map(int, input().split())
        if x > y:
            y, x = x, y
        ans -= x * (n - y + 1)
    print(ans)
    
main()
import math
from fractions import *
a,b,c,d=map(int,input().split())

def lcm(a,b):
    return a * b // math.gcd(a, b)

def f(a,b,c):
    return (b - a + 1) // c + (1 if b % c <= a % c else 0)

if c != 1 and d != 1:
    if c != d:
        print ((b-a+1) - f(a,b,c) - f(a,b,d) + f(a,b,lcm(c,d)))
    else:
        print ((b - a + 1) - f(a, b, c))
else:
    print (0)

### FIXED CODE ###

from math import *
from fractions import *
a,b,c,d=map(int,input().split())

def lcm(a,b):
    return a * b // gcd(a, b)

def f(a,b,c):
    return (b - a + 1) // c + (1 if b % c <= a % c else 0)

if c != 1 and d != 1:
    print ((b-a+1) - (b // c - ceil(a / c) + 1) - (b // d - ceil(a / d) + 1) + (b // lcm(c, d) - ceil(a / lcm(c, d)) + 1))
else:
    print (0)
import collections
import itertools
import math

def P(n, r):
    return math.factorial(n)//math.factorial(n-r)

def C(n, r):
    return P(n, r)//math.factorial(r)

N = int(input())

nums = ["".join(str(list(collections.Counter(list(input())).values()))) for _ in range(N)]
ans = 0
for i in collections.Counter(nums).values():
    ans += C(i, 2)
print(ans)

### FIXED CODE ###

N = int(input())
words = {}

ans = 0
for _ in range(N):
    w = list(input())
    w.sort()
    w = "".join(w)
    if w not in words:
        words[w] = 1
    else:
        ans += words[w]
        words[w] += 1
print(ans)
S = int(input())
x = 0
a = S//100
b = S%100
if a>=1 and a<=12:
    x+=1
if b>=1 and a<=12:
    x+=1
if x = 0:
    print("NA")
elif x = 2:
    print("AMBIGUOUS")
if x = 1:
    if a>=1 and a<=12:
        print("MMYY")
    else:
        print("YYMM")

### FIXED CODE ###

S = int(input())
x = 0
a = S//100
b = S%100
if a>=1 and a<=12:
    x+=1
if b>=1 and b<=12:
    x+=1
if x == 0:
    print("NA")
elif x == 2:
    print("AMBIGUOUS")
if x == 1:
    if a>=1 and a<=12:
        print("MMYY")
    else:
        print("YYMM")
n, a, b = map(int, input().split)
ans = 0
for i in range(n+1):
  if a<= sum(list(map(int, list(str(i))))) <= b:
    ans += 1
print(ans)

### FIXED CODE ###

n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
  if a<= sum(list(map(int, list(str(i))))) <= b:
    ans += i
print(ans)
from collections import defaultdict as dd
import bisect
n, m = map(int, input().split())
A = sorted(list(map(int, input().split())))
BC = dd(lambda: 0)
for i in range(m):
  b, c = map(int, input().split())
  BC[b] += c
print(BC)  

right_dic = {}
leht_dic = {}
for key in sorted(BC.keys(), reverse=True):
  

### FIXED CODE ###

from collections import defaultdict as dd
from collections import deque
from collections import Counter as cnt
import bisect
n, m = map(int, input().split())
A = list(map(int, input().split()))
temoti_dic = cnt(A)

add_card_dic = dd(lambda: 0)
for i in range(m):
    b, c = map(int, input().split())
    add_card_dic[c] += b

temoti_dq = deque(sorted(temoti_dic.keys()))

total = 0
for add_card in sorted(add_card_dic.keys(), reverse=True):
    pointer = bisect.bisect_left(temoti_dq, add_card)
    #print(temoti_dic, temoti_dq, add_card, add_card_dic[add_card], pointer)
    if pointer == 0:
        break
    else:
        i = 0
        add_card_num = add_card_dic[add_card]
        while add_card_num > 0 and i < pointer:
            least_temoti = temoti_dq[0]
            least_temoti_num = temoti_dic[least_temoti]
            if least_temoti_num <= add_card_num:
                total += least_temoti_num * add_card
                temoti_dq.popleft()
                del temoti_dic[least_temoti]
                add_card_num -= least_temoti_num
            else:
                temoti_dic[least_temoti] -= add_card_num
                total += add_card_num * add_card
                add_card_num = 0
            i += 1

#print(temoti_dic)
for key in temoti_dq:
    total += key * temoti_dic[key]

print(total)
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
from decimal import *
# read = sys.stdin.buffer.read
# readline = sys.stdin.buffer.readline
# readlines = sys.stdin.buffer.readlines
input = sys.stdin.readline

temp = input().split(" ")
a = int(temp[0])
b = math.floor(temp[1]*100)
ans = a*b/100
print(math.floor(ans))


### FIXED CODE ###

from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
from decimal import *
# read = sys.stdin.buffer.read
# readline = sys.stdin.buffer.readline
# readlines = sys.stdin.buffer.readlines
input = sys.stdin.readline

temp = input().split(" ")
a = Decimal(temp[0])
b = Decimal(temp[1])
ans = a*b
print(math.floor(ans))
import numpy as np
import math
n, x = map(int, input().split())
buf = input().split()
X = np.abs(np.array([int(buf[i]) for i in range(n)]) - x)
#print(X)
if(X.shape[0] == 1):
	r = X[0]
else:
	r = math.gcd(X[0], X[1])
	for i in range(n-2):
		r = math.gcd(r, X[i+2])
print(r)

### FIXED CODE ###

def gcd(a, b):
	if(a < b):
		a, b = b, a
	if(b == 0):
		return a
	else:
		return gcd(b, a % b)

import numpy as np
n, x = map(int, input().split())
a = np.abs(np.array(list(map(int, input().split())))-x)

if(a.shape[0] == 1):
	r = a[0]
else:
	r = gcd(a[0], a[1])
	for i in range(n-2):
		r = gcd(r, a[i+2])
print(r)
X, Y, Z, K = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())), reverse=True)

import heapq

heap = []
heapq.heappush(heap, (-(A[0]+B[0]+C[0]), 0, 0, 0))
added = set([(0, 0, 0)])

for _ in range(K):
    p, i, j, k = heapq.heappop(heap)
    if (i+1, j, k) not in added and i+1<X:
        heapq.heappush(heap, (-(A[i+1]+B[j]+C[k]), i+1, j, k))
        added.add((i+1, j, k))
    if (i, j+1, k) not in added and j+1<Y:
        heapq.heappush(heap, (-(A[i]+B[j+1]+C[k]), i, k+1, j))
        added.add((i, j+1, k))
    if (i, j, k+1) not in added and k+1<Z:
        heapq.heappush(heap, (-(A[i]+B[j]+C[k+1]), i, j, k+1))
        added.add((i, j, k+1))
    print(-p)

### FIXED CODE ###

import heapq
 
X, Y, Z, K = map(int, input().split())
A = sorted([int(i) for i in input().split()], reverse=True)
B = sorted([int(i) for i in input().split()], reverse=True)
C = sorted([int(i) for i in input().split()], reverse=True)
 
heap = []
heapq.heappush(heap, (-(A[0] + B[0] + C[0]), 0, 0, 0))
added = set([(0, 0, 0)])
for _ in range(K):
    p, i, j, k = heapq.heappop(heap)
    if (i + 1, j, k) not in added and i + 1 < X:
        heapq.heappush(heap, (-(A[i + 1] + B[j] + C[k]), i + 1, j, k))
        added.add((i + 1, j, k))
    if (i, j + 1, k) not in added and j + 1 < Y:
        heapq.heappush(heap, (-(A[i] + B[j + 1] + C[k]), i, j + 1, k))
        added.add((i, j + 1, k))
    if (i, j, k + 1) not in added and k + 1 < Z:
        heapq.heappush(heap, (-(A[i] + B[j] + C[k + 1]), i, j, k + 1))
        added.add((i, j, k + 1))
    print(-p)
import math

A, B, C, D = map(int, input().split())
multi = C * D
multiGcd = int((C * D) // math.gcd(C, D))

nC = int(math.floor((A - 1) / C))
nD = int(math.floor((A - 1) / D))
mC = int(math.floor(B / C))
mD = int(math.floor(B / D))

nM = int(math.floor((A - 1) / multi))
mM = int(math.floor(B / multi))

wC = mC - nC
wD = mD - nD
wM = mM - nM
wCD = wC + wD - wM

nGcd = int(math.floor((A - 1) / multiGcd))
mGcd = int(math.floor(B / multiGcd))
wGcD = mGcd - nGcd

ans = B - (A - 1) - wCD
if multiGcd != multi:
    ans += wGcD
print(ans)


### FIXED CODE ###

import fractions

A,B,C,D = map(int,input().split())
l = C*D // fractions.gcd(C,D)
x = (A-1) -(A-1)//C - (A-1)//D + (A-1)//l
y = B - B//C - B//D + B//l
print(y-x)
s=input().strip()
t=input().strip()
s_list=[]
t_list=[]
for char in s:
    s_list.append(char)
for char in t:
    t_list.append(char)
s_collection=collections.Counter(s_list)
t_collection=collections.Counter(t_list)
s_countlist=[]
t_countlist=[]
for entry in s_collection.values():
    s_countlist.append(entry)
for entry in t_collection.values():
    t_countlist.append(entry)
s_countlist.sort()
t_countlist.sort()
if s_countlist == t_countlist:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import collections
s=input().strip()
t=input().strip()
s_list=[]
t_list=[]
for char in s:
    s_list.append(char)
for char in t:
    t_list.append(char)
s_collection=collections.Counter(s_list)
t_collection=collections.Counter(t_list)
s_countlist=[]
t_countlist=[]
for entry in s_collection.values():
    s_countlist.append(entry)
for entry in t_collection.values():
    t_countlist.append(entry)
s_countlist.sort()
t_countlist.sort()
if s_countlist == t_countlist:
    print("Yes")
else:
    print("No")
# -*- coding: utf-8 -*-
N = int(input())
S = input()

moji_list = []
for i in range(N):
  moji_list.append(chr(ord(S[i]) + N))
  
print("".join(moji_list))

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
S = input()

moji_list = []

q, mod = divmod(N, 26)
for i in range(len(S)):
  if (ord(S[i])+mod) <= 90:
    moji_list.append(chr(ord(S[i]) + mod))
  else:
    moji_list.append(chr(ord(S[i]) + mod - 26))
    
  
print("".join(moji_list))
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=0
d=0
e=0
ans=0
while c<=k:
  if a[d]>=b[e]:
    c+=b[e]
    e+=1
    ans+=1
  else:
    c+=a[d]
    d+=1
    ans+=1
if c==k:
  print(ans)
else:
  print(ans-1)

### FIXED CODE ###

n, m, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
aa = [0]
bb = [0]
 
for s in range(n):
    aa.append(aa[s] + a[s])
for s in range(m):
    bb.append(bb[s] + b[s])      
ans = 0
j = m
 
for i in range(n+1):
    if aa[i] > k:
        break
    while bb[j] > k - aa[i]:
        j -= 1
    ans = max(ans, i+j)
        
print(ans)
N = int(input())
A = list(map(int, input().split()))

ans = 0
i = 0
while i < N-3:
  tmp = i
  while (A[tmp+1]-A[tmp])*(A[tmp+2]-A[tmp+1])>=0:
    tmp += 1
    if tmp == N-3:
      break
  ans += 1 
  i = tmp+2
else:
  if (A[N-2]-A[N-3])*(A[N-1]-A[N-2])>=0:
    ans += 1
  else:
    ans += 2
print(ans)

### FIXED CODE ###

#!/usr/bin/env python3
import sys

def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0
    i = 0
    while 1:
        if i == N:
            break
        # 単調非減少と単調非増加の列の長い方を採用Greedy
        a = i
        while a < N-1 and A[a] <= A[a+1]:
            a += 1
        b = i
        while b < N-1 and A[b] >= A[b+1]:
            b += 1
        i = max(a,b) + 1
        ans += 1
    print(ans)


if __name__ == '__main__':
    main()
import numpy as np
n, k = map(int, input().split())
a = list(map(int, input().split()))
current = a[:]
for _ in range(k):
    next = [1]*n
    stack = 0
    for j, v in enumerate(current):
        next[j] += int(str(stack)[-1])
        stack = str(stack)
        stack = stack[:len(stack)-1]
        if len(stack):
            stack = int(stack)
        else:
            stack = 0
        if v > 0:
            stack += int('1'*v)
    stack = 0
    for j in range(n-1, -1, -1):
        next[j] += int(str(stack)[-1])
        stack = str(stack)
        stack = stack[:len(stack) - 1]
        if len(stack):
            stack = int(stack)
        else:
            stack = 0
        if current[j] > 0:
            stack += int('1' * current[j])
    current = next
print(*current)


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
current = a[:]
for _ in range(min(42, k)):
    nex = [0]*n
    for i, v in enumerate(current):
        l = max(0, i-v)
        r = min(n-1, i+v)
        nex[l] += 1
        if r+1 < n:
            nex[r+1] -= 1
    for i in range(1, n):
        nex[i] += nex[i-1]
    current = nex

print(*current)
A, P = int(input())
P += A * 3
print(int(P / 2))

### FIXED CODE ###

A, P = map(int, input().split())
P += A * 3
print(int(P / 2))
k = int(input())

n = 1
cnt = 0
while True:
    s = str(n)
    for i in range(len(s) - 1):
        if not int(s[i + 1]) in [int(s[i]), int(s[i]) - 1, int(s[i]) + 1]:
            break
    else:
        cnt += 1
    if cnt == k:
        break
    n += 1

print(n)

### FIXED CODE ###

x, y, z = map(int, input().split())
print('{} {} {}'.format(z, x, y))
s=list(map(input().split()))
x=0
for i in range(0,len(s),2):
  if s[i]="L":
    x+=1
    
for j in range(1,len(s),2):
  if s[j]="R":
    x+=1

if x==0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s=input()
x=0
for i in range(0,len(s),2):
  if s[i]=="L":
    x+=1
    
for j in range(1,len(s),2):
  if s[j]=="R":
    x+=1

if x==0:
  print("Yes")
else:
  print("No")
c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
print(max(r))

### FIXED CODE ###

c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
r.append(c)
if not len(r):
  print(c)
else:
  print(max(r))
/*
ID: sstfmsc1
TASK: milk2
LANG: C++
*/
#include <bits/stdc++.h>
 
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define forin(i, n) for ( int i = 0; i < (int)n; ++i )
#define MAXN 50000
#define INF 1000000
typedef long long ll;
const char nl = '\n';
ll MOD = (ll)(1e9 + 7);
 
void solve()
{
    string num; 
    cin >> num;

    int suma = 0;
    for(auto x : num) suma += (int)( x - '0' );

    cout << ( ( suma % 9 == 0 ) ? "Yes" : "No" ) << nl;
    return;
}
 
int main()
{
    //freopen("milk2.in", "r", stdin);
    //freopen("milk2.out", "w", stdout);
    //IOS
    //int q; cin >> q;
    //while(q--) 
    solve();
        
    return 0;
}

### FIXED CODE ###

str = input()
sum = 0
for ch in str:
    sum += ord(ch) - ord('0')
if sum % 9 == 0:
    print("Yes")
else:
    print("No")
s = input()
a_L = deque([val for val in s])

div_L = [""]
moji = ""

counter = 0

while a_L:
    tmp = a_L.popleft()
    moji += tmp
    if moji !=  div_L[counter]:
        div_L.append(moji)
        moji = ""
        counter += 1

print(len(div_L)-1)


### FIXED CODE ###

from collections import deque
s = input()
a_L = deque([val for val in s])

div_L = [""]
moji = ""

counter = 0

while a_L:
    tmp = a_L.popleft()
    moji += tmp
    if moji !=  div_L[counter]:
        div_L.append(moji)
        moji = ""
        counter += 1

print(len(div_L)-1)
n, y = list(map(int, input().split()))

for a in range(0, n+1):
    for b in range(0, n-a+1):
        c = n-(a+b)+1
        if (10000*a + 5000*b + 1000*c) == y:
            print(a, b, c)
            break()

print(-1, -1, -1)


### FIXED CODE ###

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

for a in range(0, n+1):
    for b in range(0, n-a+1):
        c = n-(a+b)
        if (10000*a + 5000*b + 1000*c) == y:
            print(a, b, c)
            exit()

print(-1, -1, -1)
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    short h,w,ans = 0;
    cin >> h >> w;
    char ai[10];
    rep(i,h) {
        cin >> ai;
        rep(j,8) if (ai[j] == '#') ans ++;
    }
    if (ans == h+w-1) cout << "Possible\n";
    else cout << "Impossible\n";
}

### FIXED CODE ###

def search(y,x,oy,ox,r):
    if y == h-1 and x == w-1:
        return r
    l = []
    for i,j in t:
        ny,nx = y+i,x+j
        if (0 <= ny < h and 0 <= nx < w) and not (ny == oy and nx == ox):
            if a[ny][nx] == "#":
                l.append((ny,nx))

    if 1 < len(l) or len(l) == 0:
        return r
    else:
        r.add((l[0][0],l[0][1]))
        return search(l[0][0],l[0][1],y,x,r)

h,w = map(int,input().split())
a = [list(input()) for i in range(h)]
t = ((0,1),(1,0))

s = search(0,0,0,0,set([(0,0),(h-1,w-1)]))
f = True
for i in range(h):
    for j in range(w):
        if a[i][j] == "#" and not (i,j) in s:
            print("Impossible")
            exit(0)
print("Possible")
N,D = list(map(int,input().split()))
X = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for i in range(N):
  for j in range(i+1,N):
    for d in range(D):
      a += (X[i][d]-X[j][d])**2
    for l in range(a):
      if l**2==a:
        ans+=1
print(ans)
    

### FIXED CODE ###

N,D = list(map(int,input().split()))
X = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for i in range(N):
  for j in range(i+1,N):
    a = 0
    for d in range(D):
      a += (X[i][d]-X[j][d])**2
    for l in range(a+1):
      if l**2==a:
        ans+=1
print(ans)
iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    iS = int(iM ** 0.5) + 1
    aRet = []
    for i in range(2,iS + 1):
        iCounter = 0
        while iM % i == 0:
            iM = iM / i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        if iM == 1 : break
    if 1 < iM  : aRet.append(1)
    return aRet
def fnCr(iN,iR,iD):
    iR = min(iR,iN-iR)
    if iR == 1 :
        return iN
    return (iN % iD) * pow(iR,iD-2,iD) * fnCr(iN-1,iR-1,iD) % iD

aP = fPrimeCounter(iM)
if len(aP) == 0:
    print(1)
    exit()
iRet = 1
for i in aP:
    # i + iN -1  C  iN -1
    iRet *= fnCr(i+iN-1,iN-1,iD)
iRet %= iD
print(iRet)


### FIXED CODE ###

iN,iM = [int(x) for x in input().split()]
iD = 10**9 +7 #法

def fPrimeCounter(iM):
    i = 2
    iS = int(iM ** 0.5) + 1
    aRet = []
    while i < iS or iM != 1:
        iCounter = 0
        while iM % i == 0:
            iM = iM // i
            iCounter += 1
        if 0 < iCounter : aRet.append(iCounter)
        i += 1

    return aRet

#二分累乗法 iDを法として
def fBiPow(iX,iN,iD):
    iY = 1
    while iN > 0:
        if iN % 2 == 0:
            iX = iX * iX % iD
            iN = iN // 2
        else:
            iY = iX * iY % iD
            iN = iN - 1
    return iY

aP = fPrimeCounter(iM)
if aP == [] :
    print (1)
else:
    iMax = max(aP) + iN - 1
    aM = [1] * (iMax + 1)
    #階乗 iD を法とした
    for i in range(1,iMax + 1):
        aM[i] = aM[i-1] * i  % iD
    aInvM = [1]* (iMax + 1)
    aInvM[iMax] = fBiPow(aM[iMax],iD-2,iD)
    #階乗の逆元 iD を法とした
    for i in range(iMax,0,-1):
        aInvM[i-1] = aInvM[i]*i % iD

    iRet = 1
    for i in aP:
        # i + iN -1  C  iN -1
        iRet *= aM[i+iN-1] * aInvM[iN-1] * aInvM[i] % iD
    iRet %= iD
    print(iRet)