Harryxun/stf_run huggingface dataset:
def solve():
    N, M, *a = map(int, open(0).read().split())
    MOD = 1000000007

    dp = [0 for _ in range(N+1)]
    if 1 not in a:
        dp[1] = 1
        if 2 not in a:
            dp[2] = 2
    elif 2 not in a:
        dp[2] = 1

    for i in range(3, N+1):
        dp[i] = (dp[i-1] + dp[i-2]) % MOD
        if i in a:
            dp[i] = 0
    print(dp[-1])


if __name__ == '__main__':
    solve()

### FIXED CODE ###

def solve():
    N, M, *a = map(int, open(0).read().split())
    ok = [True for _ in range(N+1)]
    for i in range(M):
        ok[a[i]] = False
    MOD = 1000000007

    dp = [0 for _ in range(N+1)]
    dp[0] = 1
    for i in range(N):
        for j in range(i+1, min(N+1, i+3)):
            if ok[j]:
                dp[j] += dp[i]
                dp[j] %= MOD
    print(dp[N])


if __name__ == '__main__':
    solve()
s1, s2, s3 = map(int, input().split())
count = 0
if s1 == 1:
  count++
if s2 == 1:
  count++
if s3 == 1:
  count++
print(count)

### FIXED CODE ###

s = input()
count = 0


if s[0] == '1':
  count += 1
  
if s[1] == '1':
  count += 1
  
if s[2] == '1':
  count += 1
  
print(count)
N, K = list(map(int,input().split()))

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

for i in range(N - K):
  list_a = list(A[i:i+K])
  list_b = list(A[i+1:i+K+1])
  if list_a < list_b:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

x = int(input())

for i in range(8):
  if x >= 1800 - 200*i:
    print(i+1)
    break
x = int(input())
 if x >0:   
    num = x / 500
    w = x-(int(num)*500)
    p = w / 5   
    sum = (int(num)*1000)+(int(p)*5)
 else:
     sum = 0   
print(sum)

### FIXED CODE ###

X = int(input())
if X >0:   
    num = X / 500
    w = X-(int(num)*500)
    p = w / 5   
    sum = (int(num)*1000)+(int(p)*5)
else:
     sum = 0   
print(sum)
while 1:
	n=input()**3
	if n==0:break
	mn=n
	for i in range(1,n):
		for j in range(i,n):
			m=n-i**3-j**3
			if m<0:break
			if m<mn:mn=m
	print mn

### FIXED CODE ###

while 1:
	z3=m=input()**3
	if z3==0:break
	x=0
	while 1:
		x+=1
		x3=x**3
		y=int((z3-x3)**(1/3.))
		if y<x:break
		n=z3-x3-y**3
		if n<m:m=n
	print m
a,b,c=map(int,input().spliT())
d=abs(a-b)
e=abs(b-c)
f=abs(c-a)
L=list[d,e,f]
L.sort()
print(L[0]+L[1])




### FIXED CODE ###

a,b,c=map(int,input().split())
d=abs(a-b)
e=abs(b-c)
f=abs(c-a)
L=[d,e,f]
L.sort()
print(L[0]+L[1])
int five = 0;
int seven = 0;

if A == 5
    five ++;

    else if A == 7
        sevent ++;

if B == 5
    five ++;

    else if B == 7
        sevent ++;

if C == 5
    five ++;

    else if C == 7
        sevent ++;

if five == 2 and seven == 1
    print 'YES';
    else print 'NO';


### FIXED CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
a, b, c = map(int, input().split())
# カウンタのクリア
five_count = 0
seven_count = 0
# 5,7,5を判定
def setsu_check(x):
	global five_count, seven_count
	if x == 5:
		five_count+=1
	elif x == 7:
		seven_count+=1
# 判定関数のCALL
setsu_check(a)
setsu_check(b)
setsu_check(c)
if five_count == 2 and seven_count == 1:
	print("YES")
else:
	print("NO")
from collections import defaultdict
from itertools import accumulate


def main():
    n = int(input())
    prime_counter = [0] * int(n ** 0.5 + 2)
    acc = tuple(accumulate(range(1, 42)))  # 10^12 < 2^39

    f = 2
    while f * f <= n:
        if n % f == 0:
            n //= f
            prime_counter[f] += 1
        else:
            f += 2
    if n != 1:
        prime_counter[n] += 1

    ans = 0
    for c in prime_counter:
        for i, x in enumerate(acc):
            if c < x:
                tmp = i
                break
        ans += tmp
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import Counter
from itertools import accumulate


def prime_factorize(n):
    """素因数分解し，ユニークな素因数のsetを返す。"""
    ans = []
    ans_add = ans.append
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    n = int(input())
    primes = prime_factorize(n)
    acc = tuple(accumulate(range(1, 42)))
    counted = Counter(primes)
    ans = 0

    for c in counted.values():
        for i, x in enumerate(acc):
            if c >= x:
                tmp = i + 1
            else:
                break
        ans += tmp

    print(ans)


if __name__ == '__main__':
    main()
def main():
 n, r = map(int,input().split())
 if n >= 10:
     print(r)
 else:
     print(r + 100* (10 - k))
main()

### FIXED CODE ###

def main():
 n, r = map(int,input().split())
 if n >= 10:
     print(r)
 else:
     print(r + 100* (10 - n))
main()
# -*- coding: utf-8 -*-

N = int(input())
X, Y, H = [], [], []
for _ in range(N):
    x, y, h = map(int, input().split())
    X.append(x)
    Y.append(y)
    H.append(h)

for x in range(101):
    for y in range(101):
        hc = {H[i] + abs(X[i] - x) + abs(Y[i] - y) for i in range(N) if H[i] > 0}
        h0 = {H[i] + abs(X[i] - x) + abs(Y[i] - y) for i in range(N) if H[i] == 0}
        if len(hc) == 1 and max(h0) <= max(hc):
            print(x, y, list(hc)[0])
            break


### FIXED CODE ###

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

N = int(input())
X, Y, H = [], [], []
for _ in range(N):
    x, y, h = map(int, input().split())
    X.append(x)
    Y.append(y)
    H.append(h)

for x in range(101):
    for y in range(101):
        hc = {H[i] + abs(X[i] - x) + abs(Y[i] - y) for i in range(N) if H[i] > 0}
        h0 = {H[i] + abs(X[i] - x) + abs(Y[i] - y) for i in range(N) if H[i] == 0}
        if len(hc) == 1:
            if (len(h0) > 0 and min(h0) >= list(hc)[0]) or len(h0) == 0:
                print(x, y, list(hc)[0])
                break
A = int(input())
B = input()

answer = max(
    A + B,
    A - B,
    A * B,
)

print(answer)


### FIXED CODE ###

data = input()
data = data.split(' ')

A = int(data[0])
B = int(data[1])

answer = max(
    A + B,
    A - B,
    A * B,
)

print(answer)
a = input()

print(a+a**2+a**3)

### FIXED CODE ###

a = int(input())

print(a+a**2+a**3)
s = input()

if s.count('R') == 2:
  print(s.count('RR'+1)
else:
  print(s.count('R')

### FIXED CODE ###

s = input()
S = s.split('S')

print(max([len(i) for i in S]))
r,g,b = map(int(input().split()))
test = 100*r + 10*g + b
amari = test % 4
if amari == 0:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

r,g,b = map(int,input().split())
test = 100*r + 10*g + b
amari = test % 4
if amari == 0:
  print("YES")
else:
  print("NO")
p = input('P:')
q = input('Q:')
r = input('R:')

ABC = p + q
BCA = q + r
CAB = r + p

min = ABC
if min > BCA:
  min = BCA
  
if min > CAB:
  min = CAB

print(min)

### FIXED CODE ###

p,q,r = map(int,input().split())


ABC = p + q
BCA = q + r
CAB = r + p

min = ABC
if min > BCA:
  min = BCA
  
if min > CAB:
  min = CAB

print(min)
import numpy as np
h,w = map(int,input().split())
a = [input() for i in range(h)]
d = "."
c = 0

for i in range(h):
  if len(set(a[i])) == 1 and a[i][0] == d:
    a.remove(a[i])

at = np.array(a)
tr = at.T

for i in range(w):
  if len(set(tr[i])) == 1 and tr[i][0] == d:
    a.remove(tr[i])
    
att = np.array(tr)
trr = att.T

for j in range(len(trr)):
  print("".join(trr[j]))


### FIXED CODE ###

import numpy as np

h,w = map(int,input().split())
a = [list(input()) for i in range(h)]
ans1 = []
ans2 = []

for i in a:
  if '#' in i:
    ans1.append(i)
    
gyouretu = np.array(ans1)
gyouretuT = gyouretu.T

for i in gyouretuT:
  if '#' in i:
    ans2.append(i)
    
ans = np.array(ans2)
answer = ans.T

for i in answer:
  print(''.join(i))
S, T = input().split()
a, b = map(int, input().spilt())
U = input()

if S==U: a-=1
else: b-=1

print(a, b)

### FIXED CODE ###

S, T = input().split()
a, b = map(int, input().split())
U = input()

if S==U: a-=1
else: b-=1

print(a, b)
[a, b, c] = [int(x) for x in input().split(" ")]
k = int(input())
a_b_flg = False if a >= b else True
b_c_flg = False if b >= c else True

for kdx in range(0, k):
  if not a_b_flg:
    b = b*2
  elif not b_c_flg:
    c = c*2
  a_b_flg = False if a >= b else True
  b_c_flg = False if b >= c else True
  if a_b_flgw and b_c_flg:
    print('Yes')
    break
if not (a_b_flgw and b_c_flg):
  print('No')

### FIXED CODE ###

[a, b, c] = [int(x) for x in input().split(" ")]
k = int(input())
a_b_flg = False if a >= b else True
b_c_flg = False if b >= c else True

for kdx in range(0, k):
  if not a_b_flg:
    b = b*2
  elif not b_c_flg:
    c = c*2
  a_b_flg = False if a >= b else True
  b_c_flg = False if b >= c else True
  if a_b_flg and b_c_flg:
    print('Yes')
    break
if not (a_b_flg and b_c_flg):
  print('No')
s = map(int,input().split())
a =0
if s[0] == s[1]and s[0] != s[2] or s[1] == s[2] and s[0] != s[2] or s[0] == s[2] and s[1] != s[2]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = [int(x) for x in input().split()]
a =0
if s[0] == s[1]and s[0] != s[2] or s[1] == s[2] and s[0] != s[2] or s[0] == s[2] and s[1] != s[2]:
    print("Yes")
else:
    print("No")
import math
X,Y = map(int,input().split())
a,b = (2*Y-X)/3,(2*X-Y)/3
n = 10**9+7
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
def count():
  if not (a//1 == a and b//1==b):
    return 0
  else:
    ahat = int(a%n)
    bhat = int(b%n)
    return cmb(ahat+bhat,ahat)


print(int(count())%(10**9+7))

### FIXED CODE ###

import math
X,Y = map(int,input().split())
a,b = (2*Y-X)/3,(2*X-Y)/3
n = 10**9+7
def cmb(n, r, mod=10**9+7):
    n1, r = n+1, min(r, n-r)
    numer = denom = 1
    for i in range(1, r+1):
        numer = numer * (n1-i) % mod
        denom = denom * i % mod
    return numer * pow(denom, mod-2, mod) % mod
def count():
  if not (a//1 == a and b//1==b):
    return 0
  else:
    ahat = int(a%n)
    bhat = int(b%n)
    return cmb(ahat+bhat,ahat)


print(int(count())%(10**9+7))
K = int(input())
print('ACL' * K)

### FIXED CODE ###

K = int(input())
print('ACL' * K)
K, N = list(map(int, input().split()))

dprint = lambda *x:x

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

mod = 998244353 #出力の制限
__N = 8000
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, __N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )



def kumiawase(p, q):
    # dprint(p,q,cmb(p+q-1,q-1 ,mod))
    return cmb(p+q -1,q-1 ,mod)


def solve(n):
    assert n <= K+1
    # 組み合わせの組
    # abs(n-1)//2 + 偶数分 n//2?
    # 2 ->  1,1
    # 3 -> 1,2
    # 4 -> 1,3 2,2
    # 5 -> 1,4 2,3
    # 6 -> 1,5 2,4 3,3
    # 7  3通り

    # 組のうち片方だけ使用する数 p
    ans = 0
    kumi = (n - 1) // 2
    for p in range(kumi+1):
        # dprint("p",p,"n",n)
        if p>N:
            break
        # 使えるのは p個 + 組に関係ないやつ
        ans += 2**p *cmb(kumi,p,mod)* kumiawase(N - p, p+ (K-kumi*2- int(n%2==0) ) )
        # dprint("anstmp1",ans)
        if n % 2 == 0 and N - p -1 >= 0:
            ans += 2**p *cmb(kumi,p,mod) * kumiawase(N - p -1 , p+ (K-kumi*2- int(n%2==0) ) ) # K==n//2を使用
    # dprint("-------",ans)
    return ans


ans = []
for i in range(2, 2 * K +1):
    if i <= K+1:
        tmp = solve(i)%998244353
        ans.append(tmp)
        print(tmp)
    else:
        print(ans[-i + K])


### FIXED CODE ###

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

if K==1:
    print(N**3)
    exit()
# if K==2:
#     print( ((N+1)//2)**3 +((N//2)**3))
#     exit()
if not K%2 == 0:
    print((N//K)**3)
    exit()

# print(N/K)
print((N//K)**3 +(int(N/K + 1/2)**3))
# coding: utf-8
# Your code here!

H, W = map(int, input().split(" "))

result = True
masu = [['0' for i in range(H+2)] for j in range(W+2)]
for h in range(1, H+1):
    s = "0"+input()+"0"
    masu[h] = list(s)

# print(masu)

for h in range(1,H+1):
    for w in range(1,W+1):
        if masu[h][w] == "#":
            if "#" == masu[h+1][w] or "#" == masu[h][w+1] or "#" == masu[h-1][w] or "#" == masu[h][w-1]:
                pass
            else:
                result = False

if result:
    print("Yes")
else:
    print("No")


### FIXED CODE ###


H, W = map(int, input().split(" "))

# result = True
masu = [['.' for i in range(W+2)] for j in range(H+2)]
for h in range(H):
    s = "."+input()+"."
    masu[h+1] = s

# print(masu)

for h in range(1,H+1):
    for w in range(1,W+1):
        if masu[h][w] == "#":
            if "#" == masu[h+1][w] or "#" == masu[h][w+1] or "#" == masu[h-1][w] or "#" == masu[h][w-1]:
                pass
            else:
                # result = False
                print("No")
                exit()

print("Yes")
S = list(input())

if 'RRR' in s:
  i = 3
elif 'RR' in s:
  i = 2
elif 'R' in s:
  i = 1
else:
  i = 0
print(i)

### FIXED CODE ###

s = input()
 
if 'RRR' in s:
  i = 3
elif 'RR' in s:
  i = 2
elif 'R' in s:
  i = 1
else:
  i = 0
print(i)
if x:
    return 0
else:
    return 1

### FIXED CODE ###

x = int(input())
 
if x:
    print(0)
else:
    print(1)
A,B,K = map(int,input().split()
            
ans = []
            
for i in range(K):
  if A+i <=B:
    ans.append(A+i)
  if B-i >= A:
    ans.append(B-i)
            
            
ans = sorted(lis(set(ans)))
print(*ans,sep="\n")
          

### FIXED CODE ###

A,B,K = map(int,input().split())
            
ans=[]
            
for i in range(K):
  if A+i <=B:
    ans.append(A+i)
  if B-i >= A:
    ans.append(B-i)
            
            
ans = sorted(list(set(ans)))
print(*ans,sep="\n")
def popcount(n):
    return bin(n).count('1')


def main():
    N = int(input())
    X = input()

    X_int = int(X, 2)

    pcount_X = popcount(X_int)

    pcount_X_pls1 = pcount_X + 1
    pcount_X_mns1 = pcount_X - 1
    
    X_pls1_mod = X_int % pcount_X_pls1
    X_mns1_mod = X_int % pcount_X_mns1

    for i,bit in enumerate(X):
        bit = int(bit)
        if bit == 0:
            pcount_Xi = pcount_X_pls1
        else:
            pcount_Xi = pcount_X_mns1
            if pcount_Xi == 0:
                print(0)
                continue

        if bit == 0:
            n = (X_pls1_mod + pow(2, N-i-1, pcount_Xi)) % pcount_Xi
        else:
            n = (X_mns1_mod - pow(2, N-i-1, pcount_Xi)) % pcount_Xi

        ans = 1
        while n > 0:
            ans += 1
            n %= popcount(n)
        print(ans)
        
main()

### FIXED CODE ###

def popcount(n):
    return bin(n).count('1')


def main():
    N = int(input())
    X = input()

    X_int = int(X, 2)

    pcount_X = popcount(X_int)

    pcount_X_pls1 = pcount_X + 1
    pcount_X_mns1 = pcount_X - 1
    
    X_mod_pcount_X_pls1 = X_int % pcount_X_pls1
    if pcount_X_mns1 != 0:
        X_mod_pcount_X_mns1 = X_int % pcount_X_mns1

    for i,bit in enumerate(X):
        bit = int(bit)
        if bit == 0:
            n = (X_mod_pcount_X_pls1 + pow(2, N-i-1, pcount_X_pls1)) % pcount_X_pls1
        else:
            if pcount_X_mns1 == 0:
                print(0)
                continue
            n = (X_mod_pcount_X_mns1 - pow(2, N-i-1, pcount_X_mns1)) % pcount_X_mns1

        ans = 1
        while n > 0:
            ans += 1
            n %= popcount(n)
        print(ans)
        
main()
r = int(input())
return r**2

### FIXED CODE ###

r = int(input())
print(r**2)
a = int(input())
b = int(input())
calc = a * b;
if calc%2==0:
    print("Even")
else:
    print("Odd")
    

### FIXED CODE ###

a, b = map(int, input().split())
calc = a*b;
if calc%2==0:
    print("Even")
else:
    print("Odd")
import math

n = int(input())
a = [0]*10001
b = math.ceil(math.sqrt(n)) + 1
for i in range(1,b):
    for j in range(1,b):
        for k in range(1,b):
            ans = ((i + j) ** 2 + (j + k) ** 2 + (k + i) ** 2) //2
            a[ans] += 1

for i in range(1,n+1):
    print(a[i])

### FIXED CODE ###

import math

n = int(input())
a = [0]*100001
b = math.ceil(math.sqrt(n)) + 1
for i in range(1,b):
    for j in range(1,b):
        for k in range(1,b):
            ans = ((i + j) ** 2 + (j + k) ** 2 + (k + i) ** 2) //2
            a[ans] += 1

for i in range(1,n+1):
    print(a[i])
n,a,b = map(int, input().split())

if n == 0:
    print(0)
elif a == 0:
    print(0)
elif b == 0:
    print(n)
elif a >= n:
    print(n)
elif a+b > n > a:
    print(a)
else:
    q,mod = divmod(n, a+b)
    print(q*a + mod)

### FIXED CODE ###

s = list(input())
if s[0] == s[1]:
    if s[1] == s[2]:
        print('No')
    else:
        print('Yes')
else:
    print('Yes')
a,s=map(int,input().split())
if a%2==b%2:
  print((a+s)//2)
alse:
  print("IMPOSSIBLE")

### FIXED CODE ###

a,s=map(int,input().split())
if a%2==s%2:
  print((a+s)//2)
else:
  print("IMPOSSIBLE")
from collections import deque

N = int(input())
ab = [list(map(int, input().split())) for _ in range(N-1)]
routes = [[] for _ in range(N)]

for i in range(len(ab)):
    routes[ab[i][0]-1].append([ab[i][1]-1, i])
    routes[ab[i][1]-1].append([ab[i][0]-1, i])

route_color = [-10e+10 for _ in range(len(ab))]

route_num = [0]*N
max_route = 0
for i in range(N):
    num = len(routes[i])
    route_num[i] = num
    if max_route < num:
        max_route = num

seen = [False for _ in range(N)]

def function(num):
    seen[num] = True
    colors = set(range(max_route))
    for route in routes[num]:
        if route_color[route[1]] != -10e+10:
            colors.remove(route_color[route[1]])
        else:
            route_color[route[1]] = colors.pop()
        if seen[route[0]] == False:
            function(route[0])

function(0)
print(max_route)
for color in route_color:
    print(color+1)

### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(20000000)

N = int(input())
ab = [list(map(int, input().split())) for _ in range(N-1)]
routes = [[] for _ in range(N)]

for i in range(len(ab)):
    routes[ab[i][0]-1].append([ab[i][1]-1, i])
    routes[ab[i][1]-1].append([ab[i][0]-1, i])

route_color = [-10e+10 for _ in range(len(ab))]

route_num = [0]*N
max_route = 0
for i in range(N):
    num = len(routes[i])
    route_num[i] = num
    if max_route < num:
        max_route = num

seen = [False for _ in range(N)]

def function(num,pre_color):
    color_num = -1
    for route in routes[num]:
        color_num += 1
        if color_num == pre_color:
            color_num+=1
        if route_color[route[1]] != -10e+10:
            color_num-=1
            pass
        else:
            route_color[route[1]] = color_num
            
        if seen[route[0]] == False:
            seen[route[0]] = True
            function(route[0],route_color[route[1]])
    return

function(0,-1)
print(max_route)
for color in route_color:
    print(color+1)
def cal(n):
  ans = 0
  while n != 0:
    ans += n % 10
    n /= 10
  return n

n = int(raw_input())
if n % cal(n) == 0:
  print "Yes"
else:
  print "No"


### FIXED CODE ###

def cal(n):
  ans = 0
  while n != 0:
    ans += n % 10
    n /= 10
  return ans

n = int(raw_input())
if n % cal(n) == 0:
  print "Yes"
else:
  print "No"
while 1:
H , W = map(int, raw_input().split())

if H == W == 0:
  break
for i in range(W):
  width[i] = "#"
for j in range(H):
  print width
    
    

### FIXED CODE ###

while 1:
  h, w = map(int, raw_input().split())
  if h == 0 and w == 0:
    break
  for i in range(h):
    print "#" * w
  print""
x=input()
a=x//500*1000
b=x%500//5*5
print(a+b)

### FIXED CODE ###

x=int(input())
print(((x//500)*1000)+((x%500//5)*5))
t[] = ""
for i in range(1,13):
    t[i] = 0

s = t
h = t
c = t
d = t

num = int(input())
for i in range(num):
    m, n = input().split()
    n = int(n)
    if m == "s":
        s[n] == 1
    if m == "h":
        h[n] == 1
    if m == "c":
        h[n] == 1
    if m == "d":
        h[n] == 1

for i in range(1,13):
    if s[i] == 0:
        print("S %d" %i)

for i in range(1,13):
    if h[i] == 0:
        print("H %d" %i)

for i in range(1,13):
    if c[i] == 0:
        print("C %d" %i)

for i in range(1,13):
    if d[i] == 0:
        print("S %d" %i)






### FIXED CODE ###

#
# 6b
#

def main():
    n = int(input())
    c = []
    for i in range(n):
        m, r = input().split()
        r = int(r)
        c.append([m, r])
    for M in ["S", "H", "C", "D"]:
        for R in range(1, 14):
            for i in range(n):
                if c[i] == [M, R]:
                    break
            else:
                print(*[M, R])


if __name__ == '__main__':
    main()
import math
MOD = 1000000007
N = int(input())
A = []
d = {}
for i in range(N):
	a,b = map(int,input().split())
	g = math.gcd(a,b)
	if a < 0:
		a *= -1
		b *= -1
	if a == 0 and b < 0:
		b *= -1
	a = a // g
	b = b // g
	if (a,b) in d:
		d[(a,b)] += 1
	else:
		d[(a,b)] = 1

ans_sp = 0
if (0,0) in d:
	ans_sp += d[(0,0)]

def pow(n, k):
	ret = 1
	while k > 0:
		if k % 2 == 1:
			ret = ret * n % MOD
		n = n * n % MOD
		k = k // 2
	return ret

ans = 1
for k in d:
	a,b = k[0], k[1]
	v = d[k]
	x,y = b,-a
	if x < 0:
		x *= -1
		y *= -1
	if (x,y) in d:
		if  b > y:
			continue
		tmp = (pow(2,v) + pow(2,d[(x,y)]) - 1) % MOD
		ans = (ans * tmp) % MOD
	else:
		ans = (ans * pow(2,v)) % MOD
print(ans_sp + ans - 1)

### FIXED CODE ###

import math
MOD = 1000000007
N = int(input())
A = []
d = {}
for i in range(N):
	a,b = map(int,input().split())
	g = math.gcd(a,b)
	if a < 0:
		a *= -1
		b *= -1
	if a == 0 and b < 0:
		b *= -1
	if g != 0:
		a = a // g
		b = b // g
	if (a,b) in d:
		d[(a,b)] += 1
	else:
		d[(a,b)] = 1

ans_sp = 0
if (0,0) in d:
	ans_sp += d[(0,0)]

def pow(n, k):
	ret = 1
	while k > 0:
		if k % 2 == 1:
			ret = ret * n % MOD
		n = n * n % MOD
		k = k // 2
	return ret

ans = 1
for k in d:
	a,b = k[0], k[1]
	if a == 0 and b == 0:
		continue
	v = d[k]
	x,y = b,-a
	if x < 0:
		x *= -1
		y *= -1
	if x == 0 and y < 0:
		y *= -1
	if y == 0 and x < 0:
		x *= -1
	if (x,y) in d:
		if  b > y:
			continue
		tmp = (pow(2,v) + pow(2,d[(x,y)]) - 1) % MOD
		ans = (ans * tmp) % MOD
	else:
		ans = (ans * pow(2,v)) % MOD
print((ans_sp + ans - 1) % MOD)