Harryxun/stf_run huggingface dataset:
def findProductSum(A, n): 
      
    # calculating array sum (a1 + a2 ... + an) 
    array_sum = 0
    for i in range(0, n, 1): 
        array_sum = array_sum + A[i] 
  
    # calcualting square of array sum 
    # (a1 + a2 + ... + an)^2 
    array_sum_square = array_sum * array_sum 
  
    # calcualting a1^2 + a2^2 + ... + an^2 
    individual_square_sum = 0
    for i in range(0, n, 1): 
        individual_square_sum += A[i] * A[i] 
  
    # required sum is (array_sum_square - 
    # individual_square_sum) / 2 
    temp=int(array_sum_square - 
            individual_square_sum) / 2
    return temp%1000000007








list=list()
n=int(input())
for i in range(n):
	l=int(input())
	list.append(l)
print(findProductSum(list,n))	
	

### FIXED CODE ###

def findProductSum(A, n): 
      
    # calculating array sum (a1 + a2 ... + an) 
    array_sum = 0
    for i in range(0, n, 1): 
        array_sum = array_sum + A[i] 
  
    # calcualting square of array sum 
    # (a1 + a2 + ... + an)^2 
    array_sum_square = array_sum * array_sum 
  
    # calcualting a1^2 + a2^2 + ... + an^2 
    individual_square_sum = 0
    for i in range(0, n, 1): 
        individual_square_sum += A[i] * A[i] 
  
    # required sum is (array_sum_square - 
    # individual_square_sum) / 2 
    temp=int(array_sum_square - 
            individual_square_sum) 
    temp=temp//2
    return temp%1000000007








n = int(input())
l = list(map(int, input().split()))
print(findProductSum(l,n))
import math

A,B = input().split()
iA = int(A)
fB = float(B)
iB = math.floor(fB)
fB100 = math.floor(fB*100 - iB*100)

ans = iA * iB
ans += (fB100 * iA) // 100
print(ans

### FIXED CODE ###

A,B = input().split()
iA = int(A)
iB = int(float(B) * 100 + 0.5)

ans = (iA * iB) // 100
print(ans)
N,M = list(map(int,input().split()))
a = [int(input()) for i in range(M)]
dekai = 1000000007
import sympy as sym

def Fib(n):
	x = sym.symbols('x',nonnegative=True,integer=True)
	Fib=1/sym.sqrt(5)*(((1+sym.sqrt(5))/2)**(n-1)-((1-sym.sqrt(5))/2)**(n-1))
	result=Fib.subs(x,n)
	result=result.evalf(int(n*3/14)+1)
	return int(result)


"""
def Fib(n):
	a,b = 0,1
	if n == 1:
		return a
	elif n == 2:
		return b
	else:
		for i in range(n-2):
			a,b = b,a+b
		return b
print("Ok")
print(Fib(100000))
"""
ans = 1
for i in range(M+1):
	if i == 0:
		ans = (ans*(Fib(a[0]-(-1))%dekai))%dekai
	elif i == M:
		ans = (ans*(Fib(N+1-a[M-1])%dekai))%dekai
	else:
		ans = (ans*(Fib(a[i]-a[i-1])%dekai))%dekai
print(ans)

### FIXED CODE ###

N,M = list(map(int,input().split()))
a = [int(input()) for i in range(M)]
dekai = 1000000007
"""
import sympy as sym

def Fib(n):
	x = sym.symbols('x',nonnegative=True,integer=True)
	Fib=1/sym.sqrt(5)*(((1+sym.sqrt(5))/2)**(n-1)-((1-sym.sqrt(5))/2)**(n-1))
	result=Fib.subs(x,n)
	result=result.evalf(int(n*3/14)+1)
	return int(result)


"""
def Fib(n):
	a,b = 0,1
	if n == 1:
		return a
	elif n == 2:
		return b
	else:
		for i in range(n-2):
			a,b = b,a+b
		return b
ans = 1

if M == 0:
	print(Fib(N+1-(-1))%dekai)
	exit()

for i in range(M+1):
	if i == 0:
		ans = (ans*(Fib(a[0]-(-1))%dekai))%dekai
	elif i == M:
		ans = (ans*(Fib(N+1-a[M-1])%dekai))%dekai
	else:
		ans = (ans*(Fib(a[i]-a[i-1])%dekai))%dekai
print(ans)
n = int(input())
a = [list(map(int, input().split())) for _ in range(n)]
mod = 10 ** 9 + 7

dp = [0] * (1 << n)
dp[0] = 1

for bit in range((1 << n) - 1):
    i = bin(bit).count('1')
    for j in range(n):
        if a[i][j] and (bit >> j) & 1:
            newbit = bit | (1 << j)
            dp[newbit] += dp[bit]
    		dp[newbit] %= mod
print(dp[(1 << n) - 1])


### FIXED CODE ###

mod = 10**9+7
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
dp = [0]*(1 << n)
dp[0] = 1
for i in range(1, 1 << n):
    k = bin(i).count("1")
    for j in range(n):
        if i >> j & 1 and a[k-1][j]:
            dp[i] += dp[i ^ (1 << j)]
    dp[i] %= mod
print(dp[(1 << n)-1])
n , k = list(map(int, input().split()))
kaijou = []
kaijou.append(1)
kaijou.append(1)
i = 2
while(i <= k + 1):
    kaijou.append(i * kaijou[i - 1])
    i += 1
for i in range(1, k + 1):
    a = (kaijou[k - 1] / (kaijou[i - 1] * kaijou[n - i + 1]))
    b = ( kaijou[n - k + 1] /  (kaijou[i] * kaijou[n - k + 1 - i]))
    print(a * b % 1000000007)


### FIXED CODE ###

import numpy as np
import math

n , k = list(map(int, input().split()))
def combi(a,b):
    return  math.factorial(a) // (math.factorial(b) * math.factorial(a-b))
i = 2
mod = 10 ** 9 + 7
for i in range(1, k + 1):
    if n - k + 1 >= i and k - 1 >= i - 1:
        print(int(combi(n - k + 1,i) * combi(k - 1, i - 1) % mod))
    else:
        print(0)
def main():
    N = int(input())
    A, B, C = np.full((3,N),0)

    for i in range(N):
        A[i], B[i], C[i] = [int(x) for x in input().split()]

    DP = [[0]*3]*N

    act = [A,B,C]

    for i, X in enumerate(act):
        DP[0][i] = X[0]
    
    for i in range(N-1):
        for x, X in enumerate(act):
            for y, Y in enumerate(act):
                if x != y:
                    DP[i+1][y] = max(DP[i+1][y],DP[i][x]+Y[i+1])

    print(DP[-1].max())

if __name__ == "__main__":
    main()
    pass

### FIXED CODE ###

def main():
    N = int(input())
    DP = [[0 for i in range(3)] for j in range(N+1)]
    
    for i in range(N):
        a = list(map(int, input().split()))
        for x in range(3):
            for y in range(3):
                if x != y:
                    DP[i+1][y] = max(DP[i+1][y],DP[i][x]+a[y])
    print(max(DP[-1]))

if __name__ == "__main__":
    main()
    pass
n, m = map(int, raw_input().split())
a = []
for i in range(n):
    row = map(int, raw_input().split())
    a.append(row)
op = []
for i in range(n):
    for j in range(m - 1):
        if a[i][j] % 2 == 1:
            a[i][j + 1] += 1
            op.append([i + 1, j + 1, i + 1, j + 2])
for i in range(n - 1):
    if a[i][m - 1] % 2 == 1:
        a[i + 1][m - 1] += 1
        op.append([i + 1, m, i + 2, m])
print len(op)
for tup in op:
    print " ".join(tup)

### FIXED CODE ###

n, m = map(int, raw_input().split())
a = []
for i in range(n):
    row = map(int, raw_input().split())
    a.append(row)
op = []
for i in range(n):
    for j in range(m - 1):
        if a[i][j] % 2 == 1:
            a[i][j + 1] += 1
            op.append([i + 1, j + 1, i + 1, j + 2])
for i in range(n - 1):
    if a[i][m - 1] % 2 == 1:
        a[i + 1][m - 1] += 1
        op.append([i + 1, m, i + 2, m])
print len(op)
for tup in op:
    print " ".join(map(str, tup))
n, q = map(int, input().split(' '))
     
inf = [[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split(' '))
    inf[a-1].append(b-1)
    inf[b-1].append(a-1)
point = [0 for _ in range(n)]
for i in range(q):
    p, x = map(int, input().split(' '))
    point[p-1] += x
def add(num):
    if len(inf[num]) == 0:
        return 0
    for k in inf[num]:
        inf[k].remove(num)
        point[k] += point[num]
        add(k)
    return 0
     
add(0)
print(*point)

### 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()
import re

text = input()
if text[2] == text[3] && text[4] == text[5]:
  return "Yes"
else:
  return "No"

### FIXED CODE ###

text = input()
if len(text) < 6:
  print("No")
elif text[2] == text[3] and text[4] == text[5]:
  print("Yes")
else:
  print("No")
from math import gcd
a,b,c,d = map(int,input().split())

lcm = c*d/gcd(c,d)
print(b - a + 1 - int(b/c) + int((a-1)/c) - int(b/d) + int((a-1)/d) + int(b/lcm) - int((a-1)/lcm))

### FIXED CODE ###

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

lcm = c*d//gcd(c,d)
print(b - a + 1 - b//c + (a-1)//c - b//d + (a-1)//d + b//lcm - (a-1)//lcm)
N=int(input())
A=[int(x) for x in input().split()]

A=sorted(A)

if N%2==0:
    if all(A[i]==A[i+1] and A[0]==1 and A[i]+2==A[i+2] for i in range(0,N-2,2)):
        print(2**(N//2))
    else:
        print(0)
else:
    if all(A[0]==0 and A[i+1]==A[i+2] and A[i+1]+2==A[i+3] for i in range(0,N-2,2)):
        print(2**(N//2))
    else:
        print(0)


### FIXED CODE ###

N=int(input())
A=[int(x) for x in input().split()]
mod=10**9+7
A=sorted(A)

if N%2==0:
    if all(A[i]==A[i+1] and A[0]==1 and A[1]==1 and A[i]-2==A[i-2] for i in range(2,N,2)):
        print((2**(N//2))%mod)
    else:
        print(0)
else:
    if all(A[0]==0 and A[i]==A[i-1] and A[i]-2==A[i-2] and A[-1]==N-1 for i in range(2,N,2)):
        print((2**(N//2))%mod)
    else:
        print(0)
a=int(input())
print(Christmas+"Eve"*(25-a))

### FIXED CODE ###

a=int(input())
print("Christmas"+" Eve"*(25-a))
n=int(input())
import math
for i in range (math.sqrt(n),0,-1):
  if n%i==0:
    print(max(len(str(i)),len(str(n//i))))
    quit()

### FIXED CODE ###

n=int(input())
import math
for i in range (int(math.sqrt(n)),0,-1):
  if n%i==0:
    print(max(len(str(i)),len(str(n//i))))
    quit()
S=input()
K=int(input())
counter=0
for i in S:
    if int(i)!=1:
        log=counter
        num=int(i)
        break
    counter+=1

if K==1:
    print(S[0])
elif K<=log:
    print(1)
else:
    print(num)


### FIXED CODE ###

S = input()
K = int(input())
counter = 0
num = 1
log = 0
for i in S:
    if int(i) != 1:
        log = counter
        num = int(i)
        break
    counter += 1

if K <= log:
    print(1)
else:
    print(num)
num = list( map( int, input().split() ) )
[ a, b, c ] = sort( num )
 
if a + b == c:
  print( "Yes" )
else :
  print( "No" )

### FIXED CODE ###

nums = list( map( int, input().split() ) ) 
nums.sort()

if nums[0]+nums[1]==nums[2]:
  print("Yes")
else :
  print("No")
A = map(int, input())
B = map(int, input())

if A > 8 or B > 8:
    print(':(')
else:
    print('Yay!')

### FIXED CODE ###

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

if A > 8 or B > 8:
    print(':(')
else:
    print('Yay!')
#coding:utf-8
import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7
    S = input()
    Slist = [S]
    Q = II()
    Slist = ['']*Q+Slist+['']*Q
    left = Q-1
    right = Q+len(S)
    r = False
    for _ in range(Q):
        query = input().split()
        if query[0] == '1':
            r ^= True
        else:
            if query[1] == '1':
                    if r:
                        # S = ''.join([S,query[2]])
                        Slist[right] = query[2]
                        right += 1

                    else:
                        # S = ''.join([query[2],S])
                        Slist[left] = query[2]
                        left -=1
            else:
                if r:
                    Slist[left] = query[2]
                    left -=1
                else:
                    # S = ''.join([S,query[2]])
                    Slist[right] = query[2]
                    right += 1
    # print(S[::-1] if r else S)
    print(''.join(Slist[::-1]) if r else ''.join(Slist))
                



    

if __name__ == '__main__':
    main()

### FIXED CODE ###

#coding:utf-8
import sys,os
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7
    S = input()
    Slist = [S]
    Q = II()
    Slist = ['']*Q+Slist+['']*Q
    left = Q-1
    right = Q+1
    r = False
    for _ in range(Q):
        query = input().split()
        if query[0] == '1':
            r ^= True
        else:
            if query[1] == '1':
                    if r:
                        # S = ''.join([S,query[2]])
                        Slist[right] = query[2]
                        right += 1

                    else:
                        # S = ''.join([query[2],S])
                        Slist[left] = query[2]
                        left -=1
            else:
                if r:
                    Slist[left] = query[2]
                    left -=1
                else:
                    # S = ''.join([S,query[2]])
                    Slist[right] = query[2]
                    right += 1
    # print(S[::-1] if r else S)
    if r:
        Slist[Q] = Slist[Q][::-1]

    print(''.join(Slist[::-1]) if r else ''.join(Slist))
                



    

if __name__ == '__main__':
    main()
S=list(input())
flag=0
Ccount=0
Lcount=0
if S[0]=="A":
  flag+=1
  del S[0]
N=len(S)
for i in range(1,N-1):
  if S[i]=="C":
    Ccount+=1
    del S[i]
if Ccount==1:
  flag+=1
M=len(S)
for i in range(M):
  if S[i].islower():
    Lcount+=1
if Lcount==M:
  flag+=1
if flag==3:
  print("AC")
else:
  print("WA")
    



### FIXED CODE ###

S=list(input())
flag=0
Ccount=0
Cnumber=0
if S[0]=="A":
  flag+=1
if S[2:-1].count("C")==1:
  flag+=1
  del S[0]
  S.remove("C")
if str(S).islower():
  flag+=1
if flag==3:
  print("AC")
else:
  print("WA")
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
cnt = 0
sum = 0
flag = 0
T = X = Y = 0 
for i in range(N):
        cnt = x[i][0] - T
        sum = abs(x[i][1]- X) + abs(x[i][2]- Y)
        T = x[i][0]
        X = x[i][1]
        Y = x[i][2]
    if cnt < sum or cnt % 2 != sum % 2:
        flag = 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
cnt = 0
sum = 0
flag = 0
T = X = Y = 0
for i in range(N):
    cnt = x[i][0] - T
    sum = abs(x[i][1]- X) + abs(x[i][2]- Y)
    T = x[i][0]
    X = x[i][1]
    Y = x[i][2]
    if cnt < sum or cnt % 2 != sum % 2:
        flag = 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")
K = int(input())
S = input()

a = len(S)


if a <= K:
    print(S)
else:
    print(S[:K] + ("..."))

### FIXED CODE ###

s =str(input())
z = int(s[-1])
if z == 2 or z == 4 or z == 5 or z == 7 or z == 9:
	print("hon")
elif z == 0 or z == 1 or z == 6 or z == 8:
    print("pon")
else:
	print("bon")
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

k=int(input())
s=input()
lens=len(s)
mod=10**9+7
ans=0


now=1

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

print(ans)

### FIXED CODE ###

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 2 * 10 ** 6 + 10 # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

k=int(input())
s=input()
lens=len(s)
mod=10**9+7
ans=0

now=1

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

print(ans)
import pandas as pd
from sys import stdin

d = pd.to_datetime( stdin.readline().strip() )
print("TBD" if (d.gt(pd.to_datetime("2019/4/30"))) else "Heisei")


### FIXED CODE ###

from sys import stdin
 
i = stdin.readline().strip()
d = tuple(map(int, i.split("/")))
print("Heisei" if d <= (2019,4,30) else "TBD")
def euclid(a,b):
	if b == 0:
		return a
	else:
		return euclid(b,a % b)
		
n = int(input())
t = []
for i in range(n):
	x = int(input())
	t.append(x)

for i in range(0,n-1):
	t[i+1] = t[i] * t[i+1] / euclid(t[i],t[i+1])

print(int(t[n-1]))

### FIXED CODE ###

def euclid(a,b):
	if b == 0:
		return a
	else:
		return euclid(b,a % b)
		
n = int(input())
t = []
for i in range(n):
	x = int(input())
	t.append(x)

for i in range(0,n-1):
	t[i+1] = t[i] * t[i+1] // euclid(t[i],t[i+1])

print(int(t[n-1]))
b = input()

if b==A:
    print('T')
elif b==G:
    print('C')
elif b==T:
    print('A')
else:
    print('G')
    
    

### FIXED CODE ###

b = input()

if b=='A':
    print('T')
elif b=='G':
    print('C')
elif b=='T':
    print('A')
else:
    print('G')
S = input().split(" ")
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
E = int(S[4])
F = int(S[5])

def calculate(a, b, c, d, e, f):
    result = []

    for x in range(math.ceil(f / (a * 100))):
        for y in range(math.ceil(f / (b * 100))):
            result.append([x, y])

    maxNondu = 0
    finalResult = []
    for res in result:
        m = 0
        waterValue = res[0] * 100 * a + res[1] * 100 * b

        while waterValue + m <= f:
            n = 0
            sugerValue = m * c + n * d
            while waterValue + sugerValue <= F:
                sugerValue = m * c + n * d
                if math.ceil(sugerValue / e) * 100 <= waterValue:
                    if sugerValue + waterValue > 0:
                        nondu = sugerValue * 100 / (sugerValue + waterValue)
                        if nondu > maxNondu:
                            maxNondu = nondu

                            finalResult = [waterValue + sugerValue, sugerValue]

                n = n + 1
            m = m + 1

    if len(finalResult) == 0:
        print("{} {}".format(a,0))
    else:
        print("{} {}".format(finalResult[0],finalResult[1]))


calculate(A, B, C, D, E, F)

### FIXED CODE ###

S = input().split(" ")
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])
E = int(S[4])
F = int(S[5])

def calculate(a, b, c, d, e, f):
    result = []

    memo = {}

    for x in range(0,31):
        for y in range(0,31):
            if a * x * 100 + b * y * 100 <= F:
                result.append([x, y])

    finalResult = []
    memo = {}

    for res in result:
        waterValue = res[0] * 100 * a + res[1] * 100 * b
        for m in range(0, 101):
            for n in range(0, 101):

                sugerValue = m * c + n * d

                if waterValue + sugerValue == 0:
                    break

                if waterValue + sugerValue > f:
                    break

                if (waterValue / 100 * e) < sugerValue:
                    break

                nondu = (sugerValue * 100) / (sugerValue + waterValue)
                memo[res[0],res[1],m,n] = nondu



    maxNonDu = max(memo.values())

    for k,v in memo.items():
        if v == maxNonDu:
            print(k[0]*a*100+k[1]*b*100+k[2]*c+k[3]*d,k[2]*c+k[3]*d)
            break

    memo.values()

calculate(A, B, C, D, E, F)
# 63 B - すぬけ君の塗り絵 2 イージー
W,H,N = map(int,input().split())

X = []
Y = []
A = []
for _ in range(N):
    x,y,a = map(int,input().split())
    x -= 1;y -= 1
    X.append(x)
    Y.append(y)
    A.append(a)

mtrx = [['.']*W for _ in range(H)]

for a,(x,y) in zip(A,zip(X,Y)):
    if a == 1:
        for i in range(H):
            for j in range(x+1):
                mtrx[i][j] = '#'
    if a == 2:
        for i in range(H):
            for j in range(x+1,W):
                mtrx[i][j] = '#'
    if a == 3:
        for i in range(y+1):
            mtrx[i] = ['#']*W
    if a == 4:
        for i in range(y+1,W):
            mtrx[i] = ['#']*W
ans = 0
for i in range(H):
    for j in range(W):
        if mtrx[i][j] == '.':
            ans += 1
print(ans)

### FIXED CODE ###

# 63 B - すぬけ君の塗り絵 2 イージー
W,H,N = map(int,input().split())

X = []
Y = []
A = []
for _ in range(N):
    x,y,a = map(int,input().split())
    x -= 1;y -= 1
    X.append(x)
    Y.append(y)
    A.append(a)

mtrx = [['.']*W for _ in range(H)]

for a,(x,y) in zip(A,zip(X,Y)):
    if a == 1:
        for i in range(H):
            for j in range(x+1):
                mtrx[i][j] = '#'
    if a == 2:
        for i in range(H):
            for j in range(x+1,W):
                mtrx[i][j] = '#'
    if a == 3:
        for i in range(y+1):
            mtrx[i] = ['#']*W
    if a == 4:
        for i in range(y+1,H):
            mtrx[i] = ['#']*W

ans = 0
for i in range(H):
    for j in range(W):
        if mtrx[i][j] == '.':
            ans += 1
print(ans)
#!/usr/bin/env python
# coding: utf-8

# In[2]:


H, W = map(int, input().split())
data = [["."]*(W+2)]
for i in range(H):
    data.append(list("." + input() + "."))
data.append([["."]*(W+2)])
# print(data)


# In[5]:


flag = 0
for h in range(H+1):
#     print(data[h])
    for w in range(W+1):
#         print(data[h][w])
        if data[h][w] == "#":
            if data[h-1][w] != "#" and data[h+1][w] != "#" and data[h][w-1] != "#" and data[h][w+1] != "#":
                flag = 1
                break

if flag == 1:
    print("No")
else:
    print("Yes")


# In[ ]:






### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[2]:


# H, W = map(int, input().split())
# data = [["a"]*(W+2)]
# for i in range(H):
#     data.append(list("a" + input() + "a"))
# data.append([["a"]*(W+2)])
# # print(data)


# In[5]:


# for h in range(H+1):
# #     print(data[h])
#     for w in range(W+1):
# #         print(data[h][w])
#         if data[h][w] == "#":
#             if data[h-1][w] != "#" and data[h][w-1] != "#" and data[h][w+1] != "#" and data[h+1][w] != "#":
#                 print("No")
#                 exit()

# print("Yes")


# In[ ]:


h, w = map(int, input().split())
s = [["a"]*(w + 2)]
 
for i in range(h):
    s.append(list("a" + input() + "a"))
s.append(["a"]*(w + 2))
 
for i in range(h + 1):
    for j in range(w + 1):
        if s[i][j] == "#":
            if s[i - 1][j] != "#" and s[i][j - 1] != "#" and s[i][j + 1] != "#" and s[i + 1][j] != "#":
                print("No")
                exit()
 
print("Yes")
s = input()
t = input()
print(t + s)

### FIXED CODE ###

[s, t] = input().split(" ")
print(t + s)
al = abcdefghijklmnopqrstuvwxyz
C = input()
print(al[al.index(C)+1])

### FIXED CODE ###

al = "abcdefghijklmnopqrstuvwxyz"
C = input()
print(al[al.index(C)+1])
limit, sum_xyz = map(int, input().split())

pair = list()
x_bottom = sum_xyz - 2*limit
x_bottom = 0 if x_bottom < 0 else x_bottom

for i in range(limit, x_bottom - 1, -1):
    x = i
    y_limit = 0
    if sum_xyz - x >= limit:
        y_limit = limit
    else:
        y_limit = sum_xyz - x
    y_bottom = sum_xyz - x - limit
    y_bottom = 0 if y_bottom < 0 else y_bottom

    for j in range(y_limit, y_bottom - 1, -1):
        y = j
        z = sum_xyz - x - y
        pair.append([x, y, z])

print(len(pair))

### FIXED CODE ###

s = input()
result = s.replace(",", " ")

print(result)
N, M = map(int, input().split())
data = [[] for i in range(M)]
ans = [""] * (M+1)
num = [0] * (M+1)
for i in range(M):
    ken, year = map(int, input().split())
    data[i] = [ken, year, i]
    
data.sort(key=lambda x:x[1])

for p, y, i in data:
    num[p-1] += 1
    ans[i] = str(p).zfill(6) + str(num[p-1]).zfill(6)

for i in ans:
    print(i)

### FIXED CODE ###

N, M = map(int, input().split())
cnt = [0 for i in range(N + 1)] 
check = []
ans = []

for i in range(M):
    p, y = map(int, input().split())
    check.append((y, p, i))

check.sort()

for y, p, i in check:
    cnt[p] += 1
    ans.append((i,str(p).zfill(6)+str(cnt[p]).zfill(6)))

ans.sort()

for aa, bb in ans:
    print(bb)