Harryxun/stf_run huggingface dataset:
X=int(input())
dp = [0]*(X+1)
dp[0]=1
dp[100]=1
dp[101]=1
dp[102]=1
dp[103]=1
dp[104]=1
dp[105]=1
for i in range(106,X+1):
	    if dp[i-100] == 1:
	    	    dp[i]=1
	    elif dp[i-101] == 1:
	    	    dp[i]=1
	    elif dp[i-102] == 1:
	    	    dp[i]=1
	    elif dp[i-103] == 1:
	    	    dp[i]=1
	    elif dp[i-104] == 1:
	    	    dp[i]=1
	    elif dp[i-105] == 1:
	    	    dp[i]=1
	    else:
	    	    dp[i]=0
	    
print(dp[X])


### FIXED CODE ###

x = int(input())
f = (x%100)//5
ff = (x%100)%5
a = [0,101,102,103,104]
if 105*f+a[ff]<= x:
    print(1)
else:
    print(0)
M,D = map(int,input().split())
ans =0

if D <10:
  print("0")
  sys.exit()

for i in range(1,M+1):
  for r in range(10,D+1):
    d_tens,d_ones = divmod(r,10)
    
    if d_ones == 0 or d_ones == 1:
      continue
    elif i == d_tens*d_ones:
      ans+=1
    else:
      continue
      
print(ans)

### FIXED CODE ###

M,D = map(int,input().split())
ans = 0

for i in range(1,M+1):
  for j in range(10,D+1):
    a,b = divmod(j,10)
    
    if a>=2 and b>=2:
      if i ==a*b:
        ans += 1
       
      
      
print(ans)
a ,b = map(int ,input().split())
if a*b % 2 =0:
  print("Even")
else:
  print("Odd")


### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
a, b = map(int, raw_input().split())
print max(
  a + b,
  a - b,
  a * c
)

### FIXED CODE ###

a, b = map(int, raw_input().split())
print max(
    a + b,
    a - b,
    a * b
)
p = int(input())

q =list(str(p))
r = []
for i in range(len(q)):
    r.append(int(q[i]))
    
a = r[0]
b = [-r[1],r[1]]
c = [-r[2],r[2]]
d = [-r[3],r[3]]

e = []
for i in range(2):
    for j in range(2):
        for k in range(2):
            if a + b[i] + c[j] + d[k] == 7:
                e.append(a)
                e.append(b[i])
                e.append(c[j])
                e.append(d[k])
                
for i in range(len(e)):
    if e[i] < 0 or i == 0:
        e[i] = str(e[i])
    else:
        e[i] = '+' + str(e[i])
        
print(e[0] + e[1] + e[2] + e[3])

### FIXED CODE ###

p = str(input())

q =list(str(p))
r = []

for i in range(len(q)):
    r.append(int(q[i]))

a = r[0]
b = [-r[1],r[1]]
c = [-r[2],r[2]]
d = [-r[3],r[3]]

e = []
for i in range(2):
    for j in range(2):
        for k in range(2):
            if a + b[i] + c[j] + d[k] == 7:
                e.append(a)
                e.append(b[i])
                e.append(c[j])
                e.append(d[k])

for i in range(len(e)):
    if e[i] < 0 or i == 0:
        e[i] = str(e[i])
    else:
        e[i] = '+' + str(e[i])
        
print(e[0] + e[1] + e[2] + e[3] + '=7')
def main():
    s = list(input())
    for i in range(len(s)):
        if s[i]=="C":
            idx = i
            break

    for j in range(idx,len(s)):
        if s[j]=="F":
            print("Yes")
            exit()

    print("No")

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    s = list(input())
    for i in range(len(s)):
        for j in range(i+1,len(s)):
            if s[i]=="C" and s[j]=="F":
                print("Yes")
                exit()
    print("No")

if __name__ == '__main__':
    main()
s = r*r

### FIXED CODE ###

n = int(input())
s = n*n
print(s)
N,M = map(int, input().split())
if N != 1:
    answer = ['0']* (N-1)
    answer.insert(0,1)
else:
    answer ='1'
s_list = []
c_list = []
end = 0
for i in range(0,M):
    s, c = map(int, input().split())
    answer[s-1]= str(c)
    s_list.append(s)
    c_list.append(c)
    for i in range(0,len(s_list)):
        if (s_list[i] == s) &  (c_list[i] != c):
            end =1
            break

if end == 1:
    print(-1)
elif (len(answer) == 1) & (answer[0]=='0'):
    print(0)
elif answer[0] == '0':
    print(-1)
else:
    print(int(''.join(answer)))




### FIXED CODE ###


N,M = map(int, input().split())
if N != 1:
    answer = ['0']* (N-1)
    answer.insert(0,'1')
else:
    answer =['0']
s_list = []
c_list = []
end = 0
for i in range(0,M):
    s, c = map(int, input().split())
    answer[s-1]= str(c)
    s_list.append(s)
    c_list.append(c)
    for i in range(0,len(s_list)):
        if (s_list[i] == s) &  (c_list[i] != c):
            end =1
            break

if end == 1:
    print(-1)
elif (len(answer) == 1) & (answer[0]=='0'):
    print(0)
elif answer[0] == '0':
    print(-1)
else:
    print(int(''.join(answer)))
H,W = map(int,input().split(' '))
N = list(input())
N[W] = N[W].lower()
print("".join(N))

### FIXED CODE ###

H,W = map(int,input().split(' '))
N = list(input())
N[W-1] = N[W-1].lower()
print("".join(N))
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()
    A = LIST()

    C = Counter(A)

    X = 0
    for v in C.values():
        X += factorial(v) // (factorial(2) * factorial(v-2))

    for i in range(N):
        print(X - C[A[i]] + 1)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()
    A = LIST()

    C = Counter(A)

    X = 0
    for v in C.values():
        X += v * (v - 1) // 2

    for i in range(N):
        print(X - C[A[i]] + 1)


if __name__ == '__main__':
    main()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

a=int(input())
b=int(input())
c=int(input())

if 7 == a:
    if 5 == b and 5 == c:
        print("YES", end="\n")
elif 5 == a:
    if (7 == b and 5 == c) or (5 == b and 7 == c):
        print("YES", end="\n")
else:
    print("NO", end="\n")

### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

if 7 == a[0]:
    if 5 == a[1] and 5 == a[2]:
        print("YES", end="\n")
    else:
        print("NO", end="\n")   

elif 5 == a[0]:
    if (7 == a[1] and 5 == a[2]) or (5 == a[1] and 7 == a[2]):
        print("YES", end="\n")
    else:
        print("NO", end="\n")   
else:
    print("NO", end="\n")
N = int(input())
A = map(int,input())
maxi = 0
for i in range(N-1):
  maxi = max(maxi,A[i]-A[i+1])
print(maxi)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
maxi = 0
mini = float("inf")
for n in A:
  maxi = max(maxi,n)
  mini = min(mini,n)
print(maxi-mini)
s = input()
count = 0

for i in range(len(s)):
    if (i%2==0 and s[i]== 'R') or (i%2==0 and s[i] = 'L'):
        count = 1
        
if count ==1:
    print('No')
else:
    print('Yes')
        

### FIXED CODE ###

s = input()
count = 0

for i in range(len(s)):
    if (i%2==0 and s[i]== 'L') or (i%2==1 and s[i] == 'R'):
        count = 1
        
if count ==1:
    print('No')
else:
    print('Yes')
from math import factorial
inf = input().split()
N = int(inf[0])
K = int(inf[1])
M = N-K
for i in range(1,K+1):
  j = i+1
  red = int(factorial(M+1)/(factorial(i)*factorial(M+1-i)))
  blue = int(factorial(K-1)/(factorial(i-1)*factorial(K-i)))
  print(red*blue%(10**9+7))


### FIXED CODE ###

from operator import mul
from functools import reduce
 
def cmb(n,r):
    r = min(n-r,r)
    if r==0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

inf = input().split()
N = int(inf[0])
K = int(inf[1])
M = N-K
for i in range(1,K+1):
  if M+1<i:
    red = 0
  else:
    red = cmb(M+1,i)
  blue = cmb(K-1,i-1)
  print(red*blue%(10**9+7))
S = input()
if S == "Sunny":
    print("Cloudy")
if S == "Cloudy":
    pirnt("Rainy")
if S == "Rainy":
    print("Sunny")

### FIXED CODE ###

S = input()
if S == "Sunny":
    print("Cloudy")
if S == "Cloudy":
    print("Rainy")
if S == "Rainy":
    print("Sunny")
n = int(input())
table = list[i for i in n]
print("{} {} {}".format(min(table),max(table),sum(table)))



### FIXED CODE ###

n = input()
table = list(map(int,input().split()))
print("{} {} {}".format(min(table),max(table),sum(table)))
n = int(raw_input()) 

G = [0 for i in range(n)] 
a = [[0 for i in range(n)] for j in range(n)]
dis = [99999 for i in range(n)]

def bfs_visit(s):
    for k in range(n):
      if a[s][k] == 1:
        if dis[k] > dis[s] + 1:
          dis[k] = dis[s] + 1
          bfs_visit(k)

for i in range(n):
    G = map(int, raw_input().split())
    for j in range(G[1]):
        a[G[0]-1][G[2+j]-1] = 1
 
dis[0] = 0
for s in range(n):
    bfs_visit(s)
for s in range(n):
    if dis[s] == 99999:
       dis[s] = -1
for s in range(n):
    print (s+1, d[s])

### FIXED CODE ###

n = int(raw_input())
   
dis = [99999 for i in range(n)]
G = [0 for i in range(n)]
v = [[0 for i in range(n)] for j in range(n)]
   
def BFS(s):
  for e in range(n):
    if v[s][e] == 1:
      if dis[e] > dis[s] + 1:
        dis[e] = dis[s]+1
        BFS(e)
   
for i in range(n):
  G = map(int, raw_input().split())
  for j in range(G[1]):
    v[G[0]-1][G[2+j]-1] = 1
   
dis[0] = 0
for s in range(n):
  BFS(s)
for s in range(n):
  if dis[s] == 99999:
    dis[s] = -1
for s in range(n):
  print'{0} {1}'.format(s+1, dis[s])
N,M,K = map(int, input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

S = [0]

Sum = 0


for i in range(len(A)):
  K = K - A[i]
  if K > 0:
    Sum += 1
  else:
    K = K + A[i]
    break
S.append(Sum)

for j in range(len(B)):
  K = K - B[j]
  if K > 0:
    Sum += 1
  else:
    if i == 0:
      break
    while(K<0):
      i = i - 1
      K = K + A[i]
      Sum = Sum - 1
    Sum += 1
  S.append(Sum)
print(max(S))

### FIXED CODE ###

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

S = [0]

Sum = 0


for i in range(N):
  K = K - A[i]
  if K >= 0:
    Sum += 1
  else:
    K = K + A[i]
    break
else:
  i = N
S.append(Sum)

for j in range(M):
  K = K - B[j]
  if K >= 0:
    Sum += 1
  else:
    if i == 0:
      break
    for k in range(i):
      K = K + A[i-k-1]
      
      Sum = Sum - 1
      if K >= 0:
        i = i-k-1
        break
    else:
      i = 0
      continue
    if K >= 0:
      Sum += 1
    
  S.append(Sum)
 
print(max(S))
N = list(input())

for i in N：
    if i == "7"
    print("Yes")
    break
    
else：
    print("No")

### FIXED CODE ###

N = list(input())

for i in N:
    if i == "7":
        print("Yes")
        break
    
else:
    print("No")
from itertools import accumulate

def S(a, b):
    return cl[b] - (0 if a == 0 else cl[a-1])

if __name__ == '__main__':
    # read input
    n = int(input())
    l = list(map(int, input().split()))
    # create cumlative list first
    cl = list(accumulate(l))
    clen = len(l)

    #  0  F(i)      i i+1 G(i)      len-1
    #  |------|------|-------|-------|
    #         c0    c1       c2
    #  <-----L------> <------R------->
    # pick up a c1 (i:i+1) and evaluate
    r = list()
    result = None
    for i in range(1,clen-2):
        #print("i={}\tL{}, R{}".format(i, l[0:i+1], l[i+1:]))

        # find C0 for each i
        odiff = 1000000000
        for c in range(i):
            B = S(0,c)
            C = S(c+1,i)
            diff1 = abs(B-C)
            if odiff > diff1:
                mb = B
                mc = C
            else:
                break
            odiff = diff1

        # find C2 for each i
        odiff = 1000000000
        for c in range(i+1,clen-1):
            D = S(i+1, c)
            E = S(c+1, clen-1)
            diff2 = abs(E-D)
            if odiff > diff2:
                md = D
                me = E
            else:
                break
            odiff = diff2

        # evaluate
        diff = abs(max(mb, mc, md, me) - min(mb, mc, md, me))
        if result is None:
            result = diff
        else:
            if result > diff:
                result = diff

    print(result)

### FIXED CODE ###

from itertools import accumulate

def Sdiff(s, m, e):
    # Sdiff(s, m, e) = [A_s, A_s+1 ..., A_m] [A_m+1 .... A_e]
    #    L = cl[m]-cl[s-1], R = cl[e] - cl[m]
    # diff(L,R) = abs(cl[m] - cl[s-1] - cl[e] + cl[m]) = abs(2*cl[m] - cl[s-1] - cl[e])

    x = 0 if s == 0 else cl[s-1]
    return abs(2*cl[m] - x - cl[e])

def partial(start, end, last):
    #print("partial: {}-{} last:{}".format(start,end, last))
    odiff = Sdiff(start, last, end)

    for c in range(last, end):
        diff = Sdiff(start, c, end)
        #print("partial loop: c:{}, diff:{} -> {}".format(c, odiff, diff))
        if odiff < diff:
            return c-1
        odiff = diff
    return c

if __name__ == '__main__':
    # read input
    N = int(input())
    l = list(map(int, input().split()))
    # create cumlative list first
    cl = list(accumulate(l))

    #  0  F(i)      i i+1 G(i)      len-1
    #  |------|------|-------|-------|
    #         c0    c1       c2
    #  <-----L------> <------R------->
    # pick up a c1 (i:i+1) and evaluate
    result = 9 * 10e9
    c1 = 0
    c3 = 2
    for i in range(1, N-2):
        #print("LEFT:RIGHT {}/={}=/{}".format(l[0:i+1], i, l[i+1: N]))
        # LEFT
        c1 = partial(0, i, c1)
        # RIGHT
        c3 = partial(i+1, N-1, c3)

        # evaluate
        mb = cl[c1]
        mc = cl[i] - mb
        md = cl[c3] - cl[i]
        me = cl[N-1] - cl[c3]
        diff = abs(max(mb, mc, md, me) - min(mb, mc, md, me))
        #print("\t\t{}/{}/{}: [{} {} {} {}]".format(c1, i, c3, mb, mc, md, me))
        #print("\t\tdiff={}".format(diff))
        if diff < result:
            result = diff

    print(result)
n=int(input())
ab=[list(map(int,input().split())) for i in range(n-1)]
edge=[[] for i in range(n+1)]
iro=0
for i in ab:
  edge[i[0]].append(i[1])
for i in edge:
  if (len(i)+1)>iro:
    iro=len(i)+1
color_list=list(range(1,iro+1))
ans=[[] for i in range(n+1)]
def DFS(x,pre,color,color_list,ans):
  count=-1
  color_list=list(range(1,iro+1))
  if len(edge[x])==0:
    #print(str(pre) + "→"+ str(x) +":" + str(color))
    ans[pre].append(color)
    return
  elif 1!=x:
    #print(str(pre) + "→"+ str(x) +":" + str(color))
    ans[pre].append(color)
  for i in edge[x]:
    a=color_list.pop(-1)
    if a==color:
      a=color_list.pop(-1)
    DFS(i,x,a,color_list,ans)
    
DFS(1,-1,iro,color_list,ans)
for i in ans:
  for j in i:
    print(j)

### FIXED CODE ###

from collections import deque
n=int(input())
edge=[[] for i in range(n+1)]
ab=[]
ans=dict()
for i in range(n-1):
  a,b=map(int,input().split())
  ab.append([a,b])
  ans[(a,b)]=0
  edge[a].append(b)
  edge[b].append(a)
hantei=0  
for i in edge:
  if hantei<len(i):
    hantei=len(i)
iro=hantei
print(iro)
color_list=[0]*(n+1)
def bfs(x,ans):
  qu=deque([])
  qu.append(1)
  count=1
  while qu:
    now=qu.popleft()
    if now!=1:
      pre=qu.popleft()
    else:
      pre=0
    count=1
    for i in edge[now]:
      if i!=pre:
        qu.append(i)
        qu.append(now)
        if now!=1 and ans[(pre,now)]==count:
          count+=1
        ans[(now,i)]=count
        count+=1
  return ans
bfs(1,ans)
for i,j in ab:
  print(ans[(i,j)])
a,b=list(map(int,input().split()))
if a<=b*2:
  print 0
else:
  print a-b*2

### FIXED CODE ###

a,b=list(map(int,input().split()))
if a<=b*2:
  print(0)
else:
  print(a-b*2)
import sympy
n = int(input())
B = [1,2,6,10,15,21,28,36,45,55]
ans = 0
import math
def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

if is_prime(n) == True:
  print(ans)
  exit()


A = sympy.factorint(n)
for v in A.values():
  for i in range(len(B)):
    if v <= B[i]:
      cnt = 1
    else:
      cnt = 0
    if cnt == 0:
      ans += i+1
print(ans)

### FIXED CODE ###

import collections
import math

n = int(input())
B = [1,3,6,10,15,21,28,36,45,55,66,78,91,105]
ans = 0

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
if is_prime(n) == True:
  print(1)
  exit()

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

c = collections.Counter(prime_factorize(n))  
for v in c.values():
  for j in range(len(B)):
    if v < B[j]:
      ans += j
      break
      
print(ans)
# -*- coding : utf-8 -*-

S = str(input())

w = ""
for i in range(len(S)):
  if S[i] = "B":
    if w == "":
      w = ""
    else :
      w.remove(w[-1])
  else:
    w + S[i]

print(w)


### FIXED CODE ###

# -*- coding : utf-8 -*-

S = str(input())

w = ""

for i in range(len(S)) :
  if S[i] == "B" :
    if w == "":
      w = ""
    else :
      w = w[:-1]
  else :
    w = w + S[i]
    
print(w)
from itertools import groupby

def fivefunction(num):
    if num>=5:
        return 1
    else:
        return 0

N=input()
A=[int(N[i]) for i in range(0,len(N))]
fiveonlyzone=0
for i in range(0,len(N)):
    if i==0:
        if A[i]==5 and A[i+1]<5:
            fiveonlyzone+=1
    elif i==len(N)-1:
        if A[i-1]<5 and A[i]==5:
            fiveonlyzone+=1
    else:
        if A[i-1]<5 and A[i]==5 and A[i+1]<5:
            fiveonlyzone+=1

Ndigitsum=sum(A)
data=[fivefunction(A[i]) for i in range(0,len(N))]
Adigitsum=0
for i in range(0,len(N)):
    if fivefunction(A[i])==0:
        Adigitsum+=A[i]
X=groupby(data)
zone=0
digit=0
for key,group in X:
    g=len(list(group))
    if key==1:
        zone+=1
        digit+=g
print(9*digit+2*zone+2*Adigitsum-Ndigitsum-fiveonlyzone)

### FIXED CODE ###

def main():
    N=input()
    X=len(N)
    INF=10**100
    dp=[[INF,INF] for i in range(0,X+1)]
    dp[0][0]=0
    dp[0][1]=1
    for j in range(1,X+1):
        dp[j][0]=min(dp[j-1][0]+int(N[j-1])%10,dp[j-1][1]+10-int(N[j-1])%10)
        if int(N[j-1])%10!=9:
            dp[j][1]=min(dp[j-1][1]+9-int(N[j-1])%10,dp[j-1][0]+int(N[j-1])%10+1)
        else:
            dp[j][1]=dp[j-1][1]+9-int(N[j-1])%10
    print(dp[X][0])

if __name__ == '__main__':
    main()
import copy
import sys

n, q = map(int, sys.stdin.readline().split())

s = input()

leftLimit = -1
rightLimit = n

spells =   spell = sys.stdin.readlines()
  
for spell in reversed(spells):
  target, direction = spell.split()
  if direction == "R" and target == s[rightLimit - 1]:
    rightLimit -= 1
  if direction == "L" and target == s[leftLimit + 1]:
    leftLimit += 1

print(max(rightLimit - leftLimit - 1 , 0))


### FIXED CODE ###

import copy
import sys

n, q = map(int, sys.stdin.readline().split())

s = input()

leftLimit = -1
rightLimit = n

spells =   spell = sys.stdin.readlines()
  
for spell in reversed(spells):
  target, direction = spell.split()
  if direction == "R" and target == s[rightLimit - 1]:
    rightLimit -= 1
    if rightLimit <= 0:
      break
  try:
    if direction == "R" and target == s[leftLimit]:
      if leftLimit != -1:
         leftLimit -= 1
  except Exception as e:
    pass
  if direction == "L" and target == s[leftLimit + 1]:
    leftLimit += 1
    if leftLimit >= n-1:
      break
  try:  
    if direction =="L" and target == s[rightLimit]:
      if rightLimit != n:
        rightLimit += 1
  except Exception as e:
    pass
  #print(target, direction, leftLimit, rightLimit)

print(max(rightLimit - leftLimit - 1 , 0))
input()

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

i = 0

while all(n % 2 == 0 for n in num):
  nums = [n / 2 for n in nums]
  i += 1

print(i)
  

### FIXED CODE ###

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

count = 0
while all(n % 2 == 0 for n in Nums):
  Nums = [n/2 for n in Nums]
  count += 1

print(count)
n, m = map(int,input().split())
lst = []
for _ in range(m):
    lst.append(list(map(int,input().split())))

number = [[] for _ in range(n)]
for v in lst:
    keta,num = v[0]-1,v[1]
    if not number[keta]:
        number[keta] = num
    else:
        if number[keta] != num:
            print(-1)
            exit()
if n == 1:
    if number[0] == 0:
        print(-1)
        exit()

    if not number[0]:
        number[0] = [0]
else:
    if not number[0]:
        number[0] = [1]

for i in range(m):
    if not number[i]:
        number[i] = 0

print(''.join([str(i) for i in number]))

### FIXED CODE ###

n, m = map(int,input().split())
lst = []
for _ in range(m):
    lst.append(list(map(int,input().split())))

number = [[] for _ in range(n)]
for v in lst:
    keta,num = v[0]-1,v[1]
    if number[keta] == []:
        number[keta] = num

    if number[keta] != num:
        print(-1)
        exit()

if n == 1:
    if not number[0]:
        print(0)
    else:
        print(''.join([str(i) for i in number]))
elif n == 2:
    if number[0] == 0:
        print(-1)
        exit()
    else:
        if not number[0]:
            number[0] = 1
        if not number[1]:
            number[1] = 0
        print(''.join([str(i) for i in number]))
else:
    if number[0] == 0:
        print(-1)
        exit()
    else:
        if not number[0]:
            number[0] = 1
        if not number[1]:
            number[1] = 0
        if not number[2]:
            number[2] = 0
        print(''.join([str(i) for i in number]))
H, W, K = map(int,input().split())
dp = [[0]*W for _ in range(H+1)]
dp[0][0] = 1

ck = [0]*9
ck[0] = 1
for i in range(1,9):
  for j in range(2**i):
    for k in range(i-1):
      if k&(k+1)==True:
        continue
    else:
      ck[i] += 1

mod = 10**9+7
for i in range(1,H+1):
  for j in range(W):
    if j == 0:
      dp[i][j] = dp[i-1][j]*ck[W-2]+dp[i-1][j+1]*ck[W-3]
    elif j == W-1:
      dp[i][j] = dp[i-1][j]*ck[W-2]+dp[i-1][j-1]*ck[W-3] 
    else:
      dp[i][j] = dp[i-1][j+1]*(ck[j-1]+ck[W-j-3])+dp[i-1][j]*(ck[j-1]+ck[W-2-j])+dp[i-1][j-1]*(ck[max(0,j-2)]-1+ck[W-j-2])

print(dp[H][K-1]%mod)

### FIXED CODE ###

H, W, K = map(int,input().split())
dp = [[0]*W for _ in range(H+1)]
dp[0][0] = 1

ck = [0]*9
ck[0] = 1
for i in range(1,9):
  for j in range(2**(i-1)):
    for k in range(i-1):
      if (j>>k)&(j>>(k+1))==True:
        break
    else:
      ck[i] += 1

mod = 10**9+7
for i in range(1,H+1):
  for j in range(W):
    if (j == 0)&(j == W-1):
      dp[i][j] = dp[i-1][j]*(ck[j]*ck[W-1-j])
    elif j == 0:
      dp[i][j] = dp[i-1][j+1]*(ck[j]*ck[W-j-2])+dp[i-1][j]*(ck[j]*ck[W-1-j])
    elif j == W-1:
      dp[i][j] = dp[i-1][j]*(ck[j]*ck[W-1-j])+dp[i-1][j-1]*(ck[j-1]*ck[W-j-1])
    else:
      dp[i][j] = dp[i-1][j+1]*(ck[j]*ck[W-j-2])+dp[i-1][j]*(ck[j]*ck[W-1-j])+dp[i-1][j-1]*(ck[j-1]*ck[W-j-1])

print(dp[H][K-1]%mod)