Harryxun/stf_run huggingface dataset:
n,m = map(int,input().split())
query = [list(map(int,input().split())) for _ in range(m)]
for i in range(10**n):
    k = str(i)
    flag = True
    for s,c in query:
        if k[s-1] != str(c):
            flag = False
    if flag and len(k) == n:
        print(i)
        exit()
print(-1)

### FIXED CODE ###

n,m = map(int,input().split())
if m == 0:
    if n == 1:
        print(0)
        exit()
    if n == 2:
        print(10)
        exit()
    if n == 3:
        print(100)
        exit()

a = [-1]*n
for _ in range(m):
    s,c = map(int,input().split())
    if s == 1 and c == 0 and n == 3:
        print(-1)
        exit()
    if s == 1 and c == 0 and n == 2:
        print(-1)
        exit()
    if a[s-1] == -1:
        a[s-1] = c
    else:
        if a[s-1] != c:
            print(-1)
            exit()

ans = ""
for i in range(n):
    if a[i] == -1:
        if i == 0:
            ans += "1"
        else:
            ans += "0"
    else:
        ans += str(a[i])
print(ans)
N = int(input())
a = list(map(int, input().split()))

cnt = [0 for i in range(8)]
count = 0

for i in range(N):
    if 1<= a[i] <= 399:
        cnt[0] += 1
    elif 400<=a[i]<=799:
        cnt[1] += 1
    elif 800<=a[i]<=1199:
        cnt[2] += 1
    elif 1200<=a[i]<=1599:
        cnt[3] += 1
    elif 1600<=a[i]<=1999:
        cnt[4] += 1
    elif 2000<=a[i]<=2399:
        cnt[5] += 1
    elif 2400<=a[i]<=2799:
        cnt[6] += 1
    elif 2800<=a[i]<=3199:
        cnt[7] += 1
    else:
        count += 1


ans_min = len([s for s in cnt if s != 0])

if ans_min == 0 and count >0:
    ans_min = 1
    ans_max = ans_min + count
else:
    if ans_max > 8:
        ans_max = 8

print("{} {}".format(ans_min, ans_max))

### FIXED CODE ###

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

cnt = [0 for i in range(8)]
count = 0

for i in range(N):
    if 1<= a[i] <= 399:
        cnt[0] = 1
    elif 400<=a[i]<=799:
        cnt[1] = 1
    elif 800<=a[i]<=1199:
        cnt[2] = 1
    elif 1200<=a[i]<=1599:
        cnt[3] = 1
    elif 1600<=a[i]<=1999:
        cnt[4] = 1
    elif 2000<=a[i]<=2399:
        cnt[5] = 1
    elif 2400<=a[i]<=2799:
        cnt[6] = 1
    elif 2800<=a[i]<=3199:
        cnt[7] = 1
    else:
        count += 1

ans_min = sum(cnt)
ans_max = ans_min + count
if ans_min == 0:
    ans_min =1

print("{} {}".format(ans_min, ans_max))
n = int(input().split())
num_list = [int(i) for i in input().split()]
if len(num_list)==1:
  print(1)
else:
  res = 1
  flag = None
  pre = num_list[0]
  for i in num_list[1:]:
    if pre > i and not flag:
      flag = 'down'
  
    elif pre < i and not flag:
      flag = 'up'
      
    elif (pre > i and flag=='up') or (pre < i and flag=='down'):
      res += 1
      flag = None
    pre = i
  print(res)

### FIXED CODE ###

n = int(input())
num_list = [int(i) for i in input().split()]
if len(num_list)==1:
  print(1)
else:
  res = 1
  flag = None
  pre = num_list[0]
  for i in num_list[1:]:
    if pre > i and not flag:
      flag = 'down'
  
    elif pre < i and not flag:
      flag = 'up'
      
    elif (pre > i and flag=='up') or (pre < i and flag=='down'):
      res += 1
      flag = None
    pre = i
  print(res)
a,b,c,d = map(int, input().split())
if a > c:
    a,b,c,d = c,d,a,b
if b < c:print(0)
elif b => c and b < d:print(b-c)
else : print(d-c)

### FIXED CODE ###

a,b,c,d = map(int, input().split())
if a > c:
    a,b,c,d=c,d,a,b
if b < c:print(0)
elif b >= c and b < d:print(b-c)
else : print(d-c)
a,b,c,d,e,f=map(int,input().split())

DP=[[0,0] for _ in range(f+1)]
DP[a*100][0]=a*100
DP[b*100][0]=b*100

for i in range(f+1):
    if DP[i][0]==0:continue
    for j in a,b:
        if i+j*100<=f:
            j *=100
            if DP[i][1]*100/(i+j)>=DP[i+j][1]*100/(i+j):
                DP[i+j]=[i+j,DP[i][1]]
    for j in c,d:
        if i+j<=f and 100*(DP[i][1]+j)/(i+j)<=100*e/(100+e):
            if 100*(DP[i][1]+j)/(i+j)>=100*(DP[i+j][1])/(i+j):
                DP[i+j]=[i+j,DP[i][1]+j]

ans,water=0,[0,0]
for x,y in DP:
    if x==0:continue
    if 100*y/x>ans:
        ans=100*y/x
        water=[x,y]
print(*water)

### FIXED CODE ###

inf=10**8
a,b,c,d,e,f=map(int,input().split())
a,b=100*a,100*b
DP=[inf]*(f+max(a,b)+1)
DP[a],DP[b]=0,0

for i in range(f+1):
    if DP[i]!=inf:
        DP[i+a]=DP[i]
        DP[i+b]=DP[i]
        for j in c,d:
            if 100*(DP[i]+j)/(i+j)<=100*e/(100+e):
                DP[i+j]=max(DP[i],DP[i]+j)

ans,index=0,[a,0]
for i in range(f+1):
    if DP[i]!=inf:
        if ans<100*DP[i]/i:
            ans=100*DP[i]/i
            index=[i,DP[i]]

print(*index)
def main()
    n = int(input())
    A = []
    for _ in range(n) :
        A.append(list(map(int, input().split())))

    ans = sum([sum(_A) for _A in A])
    for k in range(n) :
        for i in range(n) :
            for j in range(n) :
                if i == k :
                    break
                elif j == k :
                    continue
                
                d = A[i][k] + A[k][j]
                if d == A[i][j] :
                    ans -= d
                elif d < A[i][j] :
                    print(-1)
                    exit()

    print(ans//2)

main()

### FIXED CODE ###

def main() :
    n = int(input())
    A = [list(map(int, input().split())) for _ in range(n)]

    ans = 0
    for i in range(n) :
        for j in range(i+1, n) :
            cost = A[i][j]
            for k in range(n) :
                if i == k or j == k:
                    continue

                d = A[i][k] + A[k][j]
                if d == A[i][j] :
                    cost = 0
                elif d < A[i][j] :
                    print(-1)
                    exit()
            ans += cost
    print(ans)

main()
S=input()

ans='NO'
if 'keyence'in S:
    ans='YES'
elif S.find('k')>=0 and S.find('k')<S.rfind('eyence'):
    ans='YES'
elif S.find('ke')>=0 and S.find('ke')<S.rfind('yence'):
    ans='YES'
elif S.find('key')>=0 and S.find('key')<S.rfind('ence'):
    ans='YES
elif S.find('keye')>=0 and S.find('keye')<S.rfind('nce'):
    ans='YES'
elif S.find('keyen')>=0 and S.find('keyen')<S.rfind('ce'):
    ans='YES'
elif S.find('keyenc')>=0 and S.find('keyenc')<S.rfind('e'):
    ans='YES'

print(ans)

### FIXED CODE ###

S=input()

ans='NO'
if S.find('k')==0 and S.rfind('eyence')==len(S)-6:
    ans='YES'
elif S.find('ke')==0 and S.rfind('yence')==len(S)-5:
    ans='YES'
elif S.find('key')==0 and S.rfind('ence')==len(S)-4:
    ans='YES'
elif S.find('keye')==0 and S.rfind('nce')==len(S)-3:
    ans='YES'
elif S.find('keyen')==0 and S.rfind('ce')==len(S)-2:
    ans='YES'
elif S.find('keyenc')==0 and S.rfind('e')==len(S)-1:
    ans='YES'

print(ans)
n,m=map(int,input().split())
graph=[[] for i in range(n)]
for i in range(m):
    l,r,d=map(int,input().split())
    graph[r-1].append((l-1,-d))
    graph[l-1].append((r-1,d))
INF=10**10
x_list=[INF]*n
import sys
def dfs(x):
    for i in graph[x]:
        if x_list[i[0]]==INF:
            x_list[i[0]]=x_list[x]+i[1]
            dfs(i[0])
        else:
            if x_list[i[0]]==x_list[x]+i[1]:
                pass
            else:
                print('No')
                sys.exit()
for i in range(n):
    if x_list[i]==INF:
        x_list[i]=0
        dfs(i)
print('Yes')


### FIXED CODE ###

import sys
n,m=map(int,input().split())
graph=[[] for i in range(n)]
for i in range(m):
    l,r,d=map(int,input().split())
    graph[r-1].append((l-1,-d))
    graph[l-1].append((r-1,d))
INF=10**9
x_list=[INF]*n
stack=[]
for i in range(n):
    if x_list[i]==INF:
        x_list[i]=0
        stack.append(i)
        while len(stack)>0:
            now=stack.pop()
            for j in graph[now]:
                if x_list[j[0]]==INF:
                    x_list[j[0]]=x_list[now]+j[1]
                    stack.append(j[0])
                else:
                    if x_list[j[0]]==x_list[now]+j[1]:
                        pass
                    else:
                        print('No')
                        sys.exit()
print('Yes')
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [LI()for i in range(n)]
inf = 10**17
mod = 10**9 + 7

a,b=MI()
print(ceil((a+b)/2))

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
#from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [LI()for i in range(n)]
inf = 10**17
mod = 10**9 + 7

a,b=MI()
print(ceil((a+b)/2))
s = int(input())

s = S % 60
m = S // 60 % 60
h = S // 60 // 60

print("{0}:{1}:{2}".format(h,m,s))

### FIXED CODE ###

S = int(input())

s = S % 60
m = S // 60 % 60
h = S // 60 // 60

print("{0}:{1}:{2}".format(h,m,s))
for i in range(5):
  a=int(input())
  b=int(input())
  c=int(input())
  d=int(input())
  e=int(input())
  if a<0 and a<b:
    x=abs(a)*c+d+b*e
    print(x)
  elif a>0 and a<b:
    y=(b-a)*e
    print(y)
  else:
    break


### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
if a<0:
  x=-a*c+d+b*e
  print(x)
else :
  y=(b-a)*e
  print(y)
s = list(input())
s = set(s)
alpha = set('abcdefghijklmnopqrstuvwxyz')
ans = sorted(alpha - s)
print(ans[0])

### FIXED CODE ###

s = list(input())
s = set(s)
alpha = set('abcdefghijklmnopqrstuvwxyz')
if s == alpha:
  print('None')
else:
  ans = sorted(alpha - s)
  print(ans[0])
D=["SUN","MON","TUE","WED","THU","FRY","SAT"]
S=input()

print(7-D.index(S))

### FIXED CODE ###

D=["SUN","MON","TUE","WED","THU","FRI","SAT"]
S=input()

print(7-D.index(S))
X = int(input())
T = int(input())
N = int(input())
Y = X
ans = 0
cnt = 1

while X < N:
    X = X + Y
    cnt = cnt + 1

ans = T * cnt
print(ans)


### FIXED CODE ###

n, x, t = map(int, input().split())
tm = (n // x) * t 
if (n % x) != 0:
    tm += t
print(tm)
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def q4():
    N = int(input())
    arr = prime_factorize(N)

    ans_count = 0
    count = 1
    min_val = min(arr)
    while arr:
        if arr.count(min_val) < count:
            arr = list(filter(lambda a: a != min_val, arr))
            count = 1
            if not arr:
                break
            min_val = min(arr)
            continue
        arr = arr[count:]
        ans_count += 1
        count += 1
    print(ans_count)


q4()

### FIXED CODE ###


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


def q4():
    N = int(input())
    arr = prime_factorize(N)
    if not arr:
        print(0)
        return

    ans_count = 0
    count = 1

    min_val = min(arr)
    while arr:
        if arr.count(min_val) < count:
            arr = list(filter(lambda a: a != min_val, arr))
            count = 1
            if not arr:
                break
            min_val = min(arr)
            continue
        arr = arr[count:]
        ans_count += 1
        count += 1
    print(ans_count)


q4()
# coding: utf-8
import os
import time
import re
import math


def main():
    global N,M,A,mod,memo
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[-1]*(N+1)
    
    mod=10**9+7
    print(dp(0))
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#

def dp(index):
    global N,M,A,mod,memo
    if(index>N):return 0
    if(index==N):memo[index]=1
    if(A.count(index)>0):memo[index]=0
    if memo[index]==-1:
        memo[index]=(dp(index+1)+dp(index+2))%mod
    return memo[index]

main()


### FIXED CODE ###

# coding: utf-8
import os
import time
import re
import math


def main():
    N,M=map(int,input().split())
    A=[int(input()) for  a in range(M)] #a (1段~N-1段)
    start=time.time();#
    memo=[0]*(N+1)
    memo[0]=1
    ban=[False]*(N+1)
    for a in A:
        ban[a]=True
    mod=1000000007
    for a in range(1,N+1):
        if ban[a]:
            memo[a]=0
        else:
            if a>1:
                memo[a]=(memo[a-1]+memo[a-2])%mod
            else:
                memo[a]=1



    print(memo[-1]%mod)
    #print("{}ms".format(math.floor(time.time()*1000-start*1000)))#


main()
a,b = input().split(' ')

c = []
for i in range(int(a)):
  c.append(input().split(' '))

count = 0
for j in range(int(a)):
  for k in range(int(a)):
    if j > k:
    ans = 0
    for l in rnage(int(b)):
      ans = ans + (int(c[j][l]) ** 2 - int(c[k][l]) ** 2) ** 0.5

    if ans = int(ans):
      count = count + 1

print(count)

### FIXED CODE ###

a,b = input().split(' ')
 
c = []
for i in range(int(a)):
  c.append(input().split(' '))

ans = 0
count = 0
for j in range(int(a)):
  for k in range(int(a)):
    if j > k:
        ans = 0
        for l in range(int(b)):
            ans = ans + (int(c[j][l]) - int(c[k][l])) ** 2
        if ans ** 0.5 == round(ans ** 0.5):
            count = count + 1

print(count)
N = int(input())
A = list(map(int,input().split()))
B = A
S = sum(A)
B.reverse()
cum1 = [0]*(N)
cum2 = [0]*(N)
now1 = 0
for i in range(N):
  now1 += A[i]
  cum1[i] = now1
  cum2[i] = S-now1
minimum = 10**9
for i in range(N):
  if abs(cum1[i]-cum2[i]) < minimum:
    minimum = abs(cum1[i]-cum2[i])
print(minimum)


### FIXED CODE ###

x,y = map(int,input().split())
ans = 0
if x<= 3:
    ans += 400000-100000*x
if y <= 3:
    ans += 400000-100000*y
if x== 1 and y == 1:
    ans += 400000
print(ans)
import sys
from operator import itemgetter

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def iif(n): return [int(input()) for _ in range(n)]
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]
def ss(): return input().split()

def main():
    mod = 1000000007

    N, M = mi()
    A = iif(M)
    DA = []
    left = 0
    for i in range(M):
        da = A[i] - left
        if da == 1 and left != 0:
            print(0)
            return
        else:
            DA.append(da-1)
        left = A[i] + 1
    if A[-1] != N:
        DA.append(N - A[-1] - 1)

    F = [1, 1]
    for i in range(100000):
        F.append(F[i] + F[i+1])

    ans = 1
    for i in DA:
        ans *= F[i]

    print(ans % mod)

    return

main()


### FIXED CODE ###

import sys
from operator import itemgetter

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def iif(n): return [int(input()) for _ in range(n)]
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]
def ss(): return input().split()

def main():
    mod = 1000000007

    F = [1, 1]
    for i in range(100000):
        F.append(F[i] + F[i+1])

    N, M = mi()

    if M == 0:
        print(F[N] % mod)
        return

    A = iif(M)
    DA = []
    left = 0
    for i in range(M):
        da = A[i] - left
        if da == 0 and left != 0:
            print(0)
            return
        else:
            DA.append(da-1)
        left = A[i] + 1
    if A[-1] != N:
        DA.append(N - A[-1] - 1)


    ans = 1
    for i in DA:
        ans *= F[i]

    print(ans % mod)

    return

main()
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

# import math
# import numpy as np
# import copy
# from collections import defaultdict, Counter
# from itertools import product
# from bisect import bisect_left, bisect_right
def inpl(): return list(map(int, input().split()))

S = list(input())
N = len(S)
while True:
    flag = False
    for i in range(1, len(S)-2):
        l = S[i-1]
        mid = S[i:i+2]
        r = S[i+2]
        if mid == ["0", "1"] or mid == ["1", "0"]:
            if (l == "0" and r == "1") or (l == "1" and r == "0"):
                del S[i:i+2]
                i -= 1
                flag = True
        if i+1 >= len(S)-2:
            break


    if flag:
        continue

    for i in range(0, len(S)-1):
        mid = S[i:i+2]
        if mid == ["0", "1"] or mid == ["1", "0"]:
            del S[i:i+2]
            i -= 1
        if i+1 >= len(S)-1:
            break

    break
print(N-len(S))


### FIXED CODE ###

# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = inpl()	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

# import math
# import numpy as np
# import copy
# from collections import defaultdict, Counter
# from itertools import product
# from bisect import bisect_left, bisect_right
def inpl(): return list(map(int, input().split()))

S = input()
N = len(S)
c0 = S.count("0")
c1 = S.count("1")

print(2*min(c0, c1))
s=input()
flag=0
if s = "abc":
  flag=1
elif s = "acb":
  flag=1
elif s = "bac":
  flag=1
elif s = "bca":
  flag=1
elif s = "cab":
  flag=1
elif s = "cba":
  flag=1
  
if flag:
  print("Yes")
else:
  print("No")    

### FIXED CODE ###

s=input()
flag=0
if s == "abc":
  flag=1
elif s == "acb":
  flag=1
elif s == "bac":
  flag=1
elif s == "bca":
  flag=1
elif s == "cab":
  flag=1
elif s == "cba":
  flag=1
  
if flag:
  print("Yes")
else:
  print("No")
k=int(input())
x,y=map(int,input().split())
d=abs(x)+abs(y)
tg=max(abs(x),abs(y))
ts=k-min(abs(x),abs(y))%k
if k%2==0 and d%2!=0:
  #print(-1)
  print(0)
else:
  ans=[]
  if d<k and d%2==1:
    n=3
    td=k-d
    if y>=0:
      ans.append((x,y+td))
      ans.append((x+(k-td//2),y+td//2))
      ans.append((x,y))
    else:
      ans.append((x,y-td))
      ans.append((x+(k-td//2),y-td//2))
      ans.append((x,y))
  elif d<k and d%2==0:
    n=2
    if abs(x)>=abs(y):
      m=(abs(x)-abs(y))//2
      tk=k-m
      if x<0:
        m*=-1
      if y<0:
        tk*=-1
      ans.append((m,tk))
    else:
      m=(abs(y)-abs(x))//2
      tk=k-m
      if y<0:
        m*=-1
      if x<0:
        tk*=-1
      ans.append((tk,m))
    ans.append((x,y))
  print(n)
  for tx,ty in ans:
    print(tx,ty)

### FIXED CODE ###

def editarr(x,y,arr):
  if abs(x)>=abs(y):
    for i in range(len(arr)):
      arr[i][0],arr[i][1]=arr[i][1],arr[i][0]
  if x<0:
    for i in range(len(arr)):
      arr[i][0]*=-1
  if y<0:
    for i in range(len(arr)):
      arr[i][1]*=-1

k=int(input())
x,y=map(int,input().split())
ans=[]
tx=abs(x)
ty=abs(y)
if tx>=ty:
  tx,ty=ty,tx
if k%2==0 and (tx+ty)%2!=0:
  print(-1)
else:
  if tx+ty<k:
    if (tx+ty)%2==0:
      m=(ty-tx)//2
      ans.append([k-m,m])
    else:
      td=k-(tx+ty)
      ans.append([tx,ty+td])
      ans.append([tx+(k-td//2),ty+td//2])
    ans.append([tx,ty])
    n=len(ans)
  elif ty-(k-tx%k)<k and (ty-(k-tx%k))%2!=0:
    if tx<k and ty<k:
      if (2*k-(tx+ty))%2==0:
        td=2*k-(tx+ty)
        ans.append([tx+td//2,k-(tx+td//2)])
        ans.append([tx,ty])
      else:
        ans.append([tx,k-tx])
        td=ty-(k-tx)
        ans.append([tx+(k-td//2),ans[-1][1]+td//2])
        ans.append([tx,ty])
      n=len(ans)
    else:
      if tx+ty<2*k:
        if (2*k-(tx+ty))%2==0:
          td=2*k-(tx+ty)
          ans.append([tx+td//2,k-(tx+td//2)])
          ans.append([tx,ty])
        else:
          ans.append([tx,k-tx])
          td=ty-(k-tx)
          ans.append([tx+(k-td//2),ans[-1][1]+td//2])
          ans.append([tx,ty])
        n=len(ans)
      else:
        ans.append([0,0])  
  else:
    ans.append([0,0])
    for i in range(tx//k):
      ans.append([ans[-1][0]+k,0])
    if ans[-1][0]!=tx:
      ans.append([tx,k-abs(tx-ans[-1][0])])
    td=ty-ans[-1][1]
    if td%k==0:
      flag=True
    else:
      flag=False
    for i in range(td//k):
      if flag==False and (ty-ans[-1][1])%2==0 and (ty-ans[-1][1])<=2*k:
          break
      ans.append([tx,ans[-1][1]+k])
    if ans[-1][1]!=ty:
      td=ty-ans[-1][1]
      ans.append([tx+(k-td//2),ans[-1][1]+td//2])
      ans.append([tx,ty])
    ans.pop(0)
    n=len(ans)
  editarr(x,y,ans)
  print(n)
  for a,b in ans:
    print(a,b)
import sys
import collections
sys.setrecursionlimit(100000)
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n, m = nm()
memo = [-1 for i in range(max(n, m) + 1)]
mod = 10 ** 9 + 7

def fact(k):
    if memo[k] != -1:
        return memo[k]
    elif k == 1:
        memo[1] = 1
        return memo[1]
    else:
        memo[k] = k * fact(k - 1)
        return memo[k]

if abs(n - m) >= 2:
    print(0)
else:
    nn = fact(n) % mod
    mm = fact(m) % mod
    if n == m:
        print(2 * nn * mm % mod)
    else:
        print(nn * mm % mod)


### FIXED CODE ###

import sys
import collections
sys.setrecursionlimit(100000)
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n, m = nm()
memo = [1 for _ in range(max(n, m) + 1)]
mod = 10 ** 9 + 7

for i in range(1, max(n, m) + 1):
    memo[i] = memo[i - 1] * i % mod

if abs(n - m) >= 2:
    print(0)
else:
    nn = memo[n] % mod
    mm = memo[m] % mod
    if n == m:
        print(2 * nn * mm % mod)
    else:
        print(nn * mm % mod)
n=int(input())
a=[0]*n
b=[0]*n
c=[0]*n
for i in range(n):
    a[i], b[i], c[i] = map(int, input().split() )

z=[[0,0,0] for _ in range(n)]
z[0]=[a[0], b[0], c[0]]
for i in range(1, n):
    z[i][0]=max(a[i]+z[i-1][1], a[i]+z[i-1][2])
    z[i][1]=max(b[i]+z[i-1][0], b[i]+z[i-1][2])
    z[i][2]=max(c[i]+z[i-1][0], c[i]+z[i-1][1])

print(max(z[-1]))


### FIXED CODE ###

n=int(input())
k=2

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

if n<3:
    print(abs(a[0]-a[-1]))
    exit()

c=[0]*n
c[-1]=0
mini=1000000

for i in reversed(range(n-k, n-1)):
    # print(i)
    c[i]=abs(a[i]-a[n-1])
    mini=min(mini, c[i])


for i in reversed(range(n-k)):
    c[i]=min([c[t]+abs(a[i]-a[t]) for t in range(i+1, i+k+1)])

# print("?", c)

print(c[0])
s=input()
from collections import defaultdict 
if len(s)<26:
  d=defaultdict(int)
  for c in s:
    d[c]+=1
  for bb in b:
    if d[bb]==0:
      print(s+bb)
      exit() 
N=len(s)
for first in range(N-1,0,-1):
  mn=s[first]
  for i in range(first-1,-1, -1):
    if s[i]<mn:
      print(s[:i]+mn)
      exit()
print(-1)
    


### FIXED CODE ###

s=input()
b="abcdefghijklmnopqrstuvwxyz"
from collections import defaultdict 
if len(s)<26:
  d=defaultdict(int)
  for c in s:
    d[c]+=1
  for bb in b:
    if d[bb]==0:
      print(s+bb)
      exit() 
N=len(s)
lst=[]
for first in range(N-1,0,-1):
  mn=s[first]
  for i in range(first-1,-1, -1):
    if s[i]<mn:
      lst.append(s[:i]+mn)
      #print(s[:i]+mn)
      #exit()
if lst:
  print(sorted(lst)[0])
  exit()
print(-1)
x = raw_input()
print x ** 3

### FIXED CODE ###

x = int(raw_input())
print x ** 3