Harryxun/stf_run huggingface dataset:
import sys

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

water_pattern = []
for i in range(f+1):
    for j in range(f+1):
        x = a*i*100 + b*j*100
        if x <= f and not x in water_pattern:
            water_pattern.append(x)

sugar_pattern = []
for i in range(f+1):
    for j in range(f+1):
        y = c*i + d*j
        if y <= f and not y in sugar_pattern:
            sugar_pattern.append(y)

sugarwater_max = -1
sugar_max = -1
concentration = 0
for i in range(len(water_pattern)):
    for j in range(len(sugar_pattern)):
        # if i == 0 and j == 0:
        #     continue
        # else:
        #     sugarwater = water_pattern[i] + sugar_pattern[j]
        #     if (water_pattern[i]/100) * e >= sugar_pattern[j] and sugarwater <= f:
        #         if sugarwater_max == -1 and sugar_max == -1:
        #             sugarwater_max = sugarwater
        #             sugar_max = sugar_pattern[j]
        #             concentration = 100 * sugar_pattern[j] / sugarwater
        #         else:
        #             if concentration < 100 * sugar_pattern[j] / sugarwater:
        #                 sugarwater_max = sugarwater
        #                 sugar_max = sugar_pattern[j]
        #                 concentration = 100 * sugar_pattern[j] / sugarwater

print("{} {}".format(sugarwater_max, sugar_max))

### FIXED CODE ###

# ABC074C - Sugar Water
# input
a, b, c, d, e, f = list(map(int, input().rstrip().split()))
A = a * 100
B = b * 100

# default values
x, y = min(a, b) * 100, 0  # density could be 0%
dens = y / x


# exhaustive search
for i in range(f // A + 1):
    for j in range(((f - A * i) // B) + 1):
        if i == 0 and j == 0:
            continue
        water = i * A + j * B
        rest = f - water
        for k in range(rest // c + 1):
            for l in range((rest - c * k) // d + 1):
                sugar = c * k + d * l
                total = water + sugar

                if sugar / total > e / (e + 100):  # compare to e (the max density)
                    break
                else:
                    if sugar / total > dens:
                        dens = sugar / total
                        x, y = total, sugar
print(x, y)
n = input()
for i in range(n):
  a = raw_input().split()

min = a[0]
max = a[0]
sum = a[0]

for num in a
  if num > max:
    max = num
  if num < min:
    min = num
  sum += num 

print ("%d %d %d") %(min, max, sum)

### FIXED CODE ###

n = input()

a = map(int, raw_input().split())

print ("%d %d %d") %(min(a), max(a), sum(a))
n, m = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
if A[m] > sum(A)/4/m:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n, m = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
if A[m-1] >= sum(A)/4/m:
    print("Yes")
else:
    print("No")
def find(tab, a):
    if tab[0][a]==-1:
        return a
    tab[0][a] = find(tab, tab[0][a])
    return tab[0][a]

def size(tab, a):
    return tab[1][a]

def union(tab, a, b):
    p1, p2 = find(tab, a), find(tab, b)
    if p1 != p2:
        tab[0][p1] = p2
        tab[1][p2] += tab[1][p1]

N, M = [int(a) for a in input().split(" ")]
ABs = [[int(a) for a in input().split(" ")] for i in range(M)]
tab = [[-1]*N, [1]*N]
arr = []

for a, b in reversed(ABs):
    pa, pb = (find(tab, a-1), find(tab, b-1))
    na, nb = (size(tab, pa), size(tab, pb))
    if pa!=pb:
        dn = ((na+nb)*(na+nb-1)//2)-(na*(na-1)//2)-(nb*(nb-1)//2)
        arr.append(dn)
        union(tab, a-1, b-1)
    else:
        arr.append(0)

acc = 0
for cp in reversed(arr):
    acc += cp
    print(acc)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

def find(tab, a):
    if tab[0][a]==a:
        return a
    tab[0][a] = find(tab, tab[0][a])
    return tab[0][a]

def union(tab, a, b):
    p1, p2 = (find(tab, a), find(tab, b))
    if p1 != p2:
        tab[0][p1] = p2
        tab[1][p2] += tab[1][p1]

def size(tab, a):
    return tab[1][a]

N, M = [int(a) for a in input().split(" ")]
ABs = [[int(a) for a in input().split(" ")] for i in range(M)]
tab = [[i for i in range(N)], [1 for i in range(N)]]
arr = []

for a, b in reversed(ABs):
        a, b = (a-1, b-1)
        pa, pb = (find(tab, a), find(tab, b))
        na, nb = (size(tab, pa), size(tab, pb))
        if pa!=pb:
            dn = ((na+nb)*(na+nb-1)//2)-(na*(na-1)//2)-(nb*(nb-1)//2)
            arr.append(dn)
            union(tab, a, b)
        else:
            arr.append(0)

acc = 0
for cp in reversed(arr):
    acc += cp
    print(acc)
n = int(raw_input())
  maxv = -1*10**9
  minv = 10**9

  for i in range(n-1):
    num = int(raw_input())
    maxv = max(maxv, num - minv)
    minv = min(minv, num)

  print maxv

### FIXED CODE ###

n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9
  
for j in range(n-1):
  nums = int(raw_input())  
  diff = nums - minv
  if maxv < diff:
    maxv = diff
  if nums < minv:
    minv = nums
  
print maxv
n = int(input())
aaa = list(map(int, input().split()))
aaa.sort()
if n % 2 == 0:
    for i in range(0, n, 2):
        if aaa[i] != aaa[i + 1]:
            print(0)
            exit()
    print(2 ** (n / 2) % (10 ** 9 + 7))
else:
    for i in range(1, n, 2):
        if aaa[i] != aaa[i + 1]:
            print(0)
            exit()
    print(2 ** ((n - 1) / 2) % (10 ** 9 + 7))

### FIXED CODE ###

def pow_mod(n, k, m):
    if k == 0:
        return 1
    if k & 1:
        return (pow_mod(n, k - 1, m) * n % m) % m
    else:
        return (pow_mod(n, k // 2, m) ** 2) % m

n = int(input())
aaa = list(map(int, input().split()))
mod = 10 ** 9 + 7
aaa.sort()
if n % 2 == 0:
    for i in range(0, n, 2):
        if aaa[i] != aaa[i + 1]:
            print(0)
            exit()
    print(pow_mod(2, (n // 2), mod))
else:
    for i in range(1, n, 2):
        if aaa[i] != aaa[i + 1]:
            print(0)
            exit()
    print(pow_mod(2, ((n - 1) // 2), mod))
n=int(input())
s=input()
ans=s.cpount("ABC")
print(ans)

### FIXED CODE ###

n=input()
s=input()

print(s.count("ABC"))
a,b,c = map(int,input().split())

if b//a >= c:
  print(c)
elif:
  print(b//a)

### FIXED CODE ###

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

if b//a >= c:
  print(c)
else:
  print(b//a)
N, M = map(int, input().split())
A = [int(i) for i in input().split()]

S = 0

for k in range (0 , N):
	S += A[k]

for j in range (0 , N):
  	m = 0
  	if A[j] >= S / ( 4 * M ):
    	m = m + 1
    
if m >= M:
  	print ( "Yes" )
else:
 	print ( "No" ) 
    

### FIXED CODE ###

N, M = map(int, input().split())
A = [int(i) for i in input().split()]

S = 0

for k in range (0 , N):
	S += A[k]

m = 0
for j in range (0 , N):
	if A[j] >= (S / ( 4 * M )):
		m = m + 1

if m >= M:
  	print ( "Yes" )
else:
 	print ( "No" )
n, m = map(int, input().split())

a = []
b = []

for i in range(n):
    a.append(list(input()))
for i in range(m):
    b.append(list(input()))

for s_h in range(n - m):
    for s_w in range(n - m):
        flag = True
        for i in range(m):
            for j in range(m):
                if a[s_h + i][s_w + j] != b[i][j]:
                    flag = False
                    break
            if not flag:
                break
        if flag:
            print("Yes")
            break
    if flag:
        break
if not flag:
    print("No")

### FIXED CODE ###

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

a = []
b = []

for i in range(n):
    a.append(list(input()))
for i in range(m):
    b.append(list(input()))



for s_h in range(n - m + 1):
    for s_w in range(n - m + 1):
        flag = True
        for i in range(m):
            for j in range(m):
                if a[s_h + i][s_w + j] != b[i][j]:
                    flag = False
                    break
            if not flag:
                break
        if flag:
            print("Yes")
            break
    if flag:
        break
if not flag:
    print("No")
X,Y,Z = map(int,input().split(" "))
ans = (X-Z)//(Y+Z)
print(ans)


### FIXED CODE ###

x,y=input().split()
if x > y:
  print(">")
elif x==y:
  print("=")
else:
  print("<")
s=input()
k=input()
if s[0]=="1":
  print(s[1])
else:
  print(s[0])

### FIXED CODE ###

s=input()
k=int(input())
c=0

if k==1:
  print(s[0])
elif k>1:
  while c<k-1 and s[c]=="1":
    c+=1

  if k-1<c:
    print(s[c-1])
  else:
    print(s[c])
print(input(),count('1')

### FIXED CODE ###

print(input().count('1'))
a = int(input())
s = input()
k = int(input())

t = ["*"]*a
aa = s[k]
for f,i in enumerate(s):
  if i == aa:
    t[f] = i
print(" ".join(aa))


### FIXED CODE ###


a = int(input())
s = input()
k = int(input())

t = ["*"]*a
aa = s[k-1]
for f,i in enumerate(s):
  if i == aa:
    t[f] = i
print("".join(t))
from collections import Counter
N = int(input())
p = list(map(int, input().split()))

cnt = Counter(p)

ps = set(p)
plst = list(ps)
plst.sort()
temp = plst[:]
jdg = [True]*N
ans = 0
#while temp:
for l, q in enumerate(plst):
    if not jdg[l]: continue

    for j in range(l+1, N):
        if plst[j]%q==0: jdg[j]=False
    if cnt[q] == 1: ans += 1
print(ans)

### FIXED CODE ###

from collections import Counter
N = int(input())
p = list(map(int, input().split()))

cnt = Counter(p)

ps = set(p)
plst = list(ps)
plst.sort()

ans = [0] * (plst[-1] + 1)

for i in range(len(plst)):
    for j in range(plst[i], plst[-1]+1, plst[i]):
        ans[j] += 1
d = 0
for i in range(len(plst)):
    if ans[plst[i]]==1 and cnt[plst[i]]==1: d += 1
print(d)
import math
r=int(input())
print('{0:.5f} {1:.5f}'.format(math.pi*r*r,math.pi*r*2))

### FIXED CODE ###

import math
r=float(input())
print('{0:.5f} {1:.5f}'.format(math.pi*r*r,math.pi*r*2))
import sys
input = sys.stdin.readline

def digit_sum(n, b):
    res = 0
    while n > 0:
        res += n % b
        n //= b
    return res

def main():
    n = int(input())
    s = int(input())
    
    ans = -1
    if n == s:
        ans = n + 1
    else:
        for b in range(2, int(n**0.5) + 1):
            if digit_sum(n, b) == s:
                ans = b
                break
        
        else:
            for p in range(1, int(n**0.5)+1):
                b = (n - s) // p + 1
                if digit_sum(n, b) == s:
                    ans = b
                    break
    
    print(ans)



if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline

def digit_sum(n, b):
    res = 0
    while n > 0:
        res += n % b
        n //= b
    return res

def main():
    n = int(input())
    s = int(input())
    ans = -1

    if n < s:
        ans = -1

    elif n == s:
        ans = n + 1

    else:
        key = []
        start, first = n, 1

        for i in range(1, n):
            first = digit_sum(n, start)
            end = start - n // i // (i + 1)
            if start == end+1:
                judge = start
                break

            while end > 1:
                if digit_sum(n, end) == i * (start - end) + first:
                    end -= 1
                    continue
                break
            next_start = end
            value = digit_sum(n, start)
            end = value + (start - end - 1) * i
            key.append((start, value, end, i, first))
            judge = start
            start = next_start
            if start == 1:
                break

        for i in range(2, judge + 1):
            sub = digit_sum(n, i)
            if sub == s:
                ans = i
                break
        else:
            for index, start, end, i, first in reversed(key):
                if end < s or s < start:
                    continue
                if (s - start) % i:
                    continue
                ans = index - (s - first) // i
                break

    print(ans)


if __name__ == "__main__":
    main()
def dia(Node):
	lst = []
	if(len(Node) == 0):
		lst.append(1)
	else:
		for n in Node:
			t = dia(d[n])
			lst.append(t+1)
	return max(lst)
		
N = input()
A = []
for i in range(N-1):
	a2,b2 = map(int, raw_input().split())
	if(a2 > b2):
		a2,b2 = b2,a2
	k = [a2,b2]
	A.append(k)
root = A[0][0]
rootd = [A[0][1]]
d = {A[0][0]:[A[0][1]],A[0][1]:[]}
for i in range(1,N-1):
	if(A[i][0] in d):
		t = d[A[i][0]]
		n = A[i][1]
	elif(A[i][1] in d):
		t = d[A[i][1]]
		n = A[i][0]
	t.append(n)
	d[n] = []
lst = []
for n in d[root]:
	lst.append(dia(d[n]))
m1 = max(lst)
lst.remove(m1)
if(len(lst) == 0):
	m2 = 1
else:
	m2 = max(lst)+1
if((m1 + m2) % 3 == 2):
	print("Second")
else:
	print("First")

### FIXED CODE ###

from collections import deque
def dia(i):
	lst = [-1]*N
	lst[i] = 0
	q = deque([i])
	while q:
		c = q.popleft()
		l = lst[c]
		for i in A[c]:
			if lst[i] != -1:
				continue
			else:
				lst[i] = l+1
				q.append(i)
	return lst.index(max(lst))
def dia2(i):
	lst = [-1]*N
	lst[i] = 0
	q = deque([i])
	while q:
		c = q.popleft()
		l = lst[c]
		for i in A[c]:
			if lst[i] != -1:
				continue
			else:
				lst[i] = l+1
				q.append(i)
	return max(lst)+1
N = input()
A = [[] for i in range(N)]
for i in range(N-1):
	a2,b2 = map(int, raw_input().split())
	A[a2-1].append(b2-1)
	A[b2-1].append(a2-1)
if((dia2(dia(0))) % 3 == 2):
	print("Second")
else:
	print("First")
S, W = int(input())

if S <= W:
    print('unsafe')
    elif S > W
    print('safe')
    


### FIXED CODE ###

S, W = map(int, input().split())

if S <= W:
    print('unsafe')
else:
    print('safe')
n = int(input())
h = list(map(int, input().split()))

def jump(x):
    if x == 1:
        return 0
    elif x == 2:
        return abs(h[1]-h[0])
    return min(jump(x-2)+abs(h[x-1]-h[x-3]), jump(x-1)+abs(h[x-1]-h[x-2]))

print(jump(n))

### FIXED CODE ###

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

cost0 = 0
cost1 = abs(h[1]-h[0])
if n ==1:
    print(cost0)
else:
    for i in range(n-2):
        cost0, cost1 = cost1, min(cost0+abs(h[i+2]-h[i]), cost1+abs(h[i+2]-h[i+1]))
    print(cost1)
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

def solve():
    N = INT()
    xbin = input()
    xdec = int(xbin, 2)
    m = xbin.count('1')

    a = xdec % (m+1)
    b = xdec % (m-1)

    num = [0]*N
    for i in range(1, N):
        num[i] = num[i % bin(i).count('1')] + 1

    for i in range(N):
        if xbin[i] == '0':
            y = ( a + pow(2, N-i-1, m+1) ) % ( m+1 )
            print(num[y] + 1)
        elif m <= 1:
            print(0)
        else:
            y = ( b + pow(2, N-i-1, m-1) ) % ( m-1 )
            print(num[y] + 1)

if __name__ == '__main__':
    solve()

### FIXED CODE ###

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def MAP1()  : return map(lambda x:int(x)-1,input().split())
def LIST()  : return list(MAP())
def LIST1() : return list(MAP1())

def solve():
    N = INT()
    xbin = input()
    xdec = int(xbin, 2)
    m = xbin.count('1')

    a = xdec % (m+1)
    b = xdec % (m-1) if m > 1 else 0

    num = [0]*N
    for i in range(1, N):
        num[i] = num[i % bin(i).count('1')] + 1

    for i in range(N):
        if xbin[i] == '0':
            y = ( a + pow(2, N-i-1, m+1) ) % ( m+1 )
            print(num[y] + 1)
        elif m <= 1:
            print(0)
        else:
            y = ( b - pow(2, N-i-1, m-1) ) % ( m-1 )
            print(num[y] + 1)

if __name__ == '__main__':
    solve()
import math

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


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


print(lcm(A, B))


### FIXED CODE ###

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


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

# a,bの最小公倍数


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


print(lcm(A, B))
def solve():
	a, b, c = map(int, raw_input().strip().split())
    d = c - a - b
    if d <= 0: return False
    return 4 * a * b < d * d

print 'Yes' if solve() else 'No'


### FIXED CODE ###

def solve():
  a, b, c = map(int, raw_input().strip().split())
  d = c - a - b
  if d <= 0: return False
  return 4 * a * b < d * d

print 'Yes' if solve() else 'No'
H, W = (int(x) for x in input().split())
if H * W % 2 == 0:
    k = H * W / 2
else:
    if H == 1 or W == 1:
        a = map(lambda x: x != 1, [H, W])
        k = int(a / 2) + 1
    else:
        k = int(H/2) + (int(W/2))*H + 1
print(k)

### FIXED CODE ###

H, W = (int(x) for x in input().split())

if H == 1 or W == 1:
    k = 1
elif H*W % 2 == 1:
    k = int(H / 2) + (int(W / 2)) * H + 1
else:
    k = int(H * W / 2)

print(k)
n = input()
a = int(n[0:2])
b = int(n[2:])
if a > 12 and b > 12:
  print('NA')
elif a 
elif a > 12 and b <= 12:
  print('YYMM')
elif a <= 12 and b > 12:
  print('MMYY')
else:
  print('AMBIGUOUS')

### FIXED CODE ###

n = input()
a = int(n[:2])
b = int(n[2:])
if 1 <= a <= 12 and 1 <= b <= 12:
	print('AMBIGUOUS')
elif 1 <= a <= 12:
	print('MMYY')
elif 1 <= b <= 12:
	print('YYMM')
else:
	print('NA')
def greedy(N,L,ices):
    counts = 1
    while True:
        # print(ices)
        for i in range(len(ices)):
            if 0 < i < N-1:
                if ices[i] > ices[i-1] and ices[i] > ices[i+1]:
                    ices[i] += 1
                    if ices[i] >= L:
                        ices[i] = 0
            elif i == 0:
                if ices[i] > ices[1]:
                    ices[i] += 1
                    if ices[i] >= L:
                        ices[i] = 0
            elif i == N-1:
                if ices[i] > ices[N-2]:
                    ices[i] += 1
                    if ices[i] >= L:
                        ices[i] = 0

        if ices.count(0) == N:
            print(counts)
            return
        counts += 1


N,L = input().rstrip().split()
ices = []
while True:
    ice = input().rstrip()
    ices.append(ice)
    if len(ices) == N:
        break

# N = 4
# L = 6
# ices = [4,2,3,5]

greedy(N,L,ices)

### FIXED CODE ###

def orderN(N,L,ices):
    upPeak = L - ices[0]
    downPeak = L - ices[0]
    peaks = []
    for i in range(len(ices)):
        if i < N-1:
            if ices[i] < ices[i+1]:
                peaks.append(downPeak)
                downPeak = L - ices[i+1]
                upPeak += L - ices[i+1]
            elif ices[i] > ices[i+1]:
                peaks.append(upPeak)
                upPeak = L - ices[i+1]
                downPeak += L - ices[i+1]
        elif i == N-1:
            peaks.append(upPeak)
            peaks.append(downPeak)
    print(max(peaks))

N,L = map(int,input().strip().split())
ices = [int(input().strip()) for _ in range(N)]


orderN(N,L,ices)
def main():
    from collections import deque
    n, q = map(int, input().split())
    t = [[] for _ in range(n)]
    for _ in range(n-1):
        a, b = map(lambda x: int(x)-1, input().split())
        t[a].append(b); t[b].append(a)
    c = [0]*n
    for i in range(q):
        p, x = map(int, input().split())
        p -= 1
        c[p] += x
    dq = deque([0])

    def dfs(node, p=-1):
        for child in t[node]:
            if child==p:
                continue
            c[child] += c[node]
            dfs(child, node)
    dfs(0)
    print(*c)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

n, q = map(int, input().split())
g = [list() for i in range(n)]
node = [0] * n

for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1; b -= 1
    g[a].append(b)
    g[b].append(a)

for i in range(q):
    p, x = map(int, input().split())
    node[p-1] += x

def dfs(v, p=-1):
    for u in g[v]:
        if u == p: continue
        node[u] += node[v]
        dfs(u, v)

dfs(0)
print(*node)
n=int(input())
A=[]
X=[]
Y=[]
for i in range(n):
  a=int(input())
  A.append(a)
  x=[]
  y=[]
  for j in range(a):
    x1,y1=[int(s) for s in input().split()]
    x.append(x1)
    y.append(y1)
  X.append(x)
  Y.append(y)
  
c=0
for i in range(n):
  l=[1]*n
  for j in range(i, n-i):
    if l[j]==0:continue
    for k in range(A[j]):
    　　l[X[j][k]] *= Y[j][k]
  if c<l.count(1):
    c=l.count(1) 
  
        
  
print(c)  
  
  
  
  
  
  
  
  
  
  
  
  
  

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
from collections import defaultdict
from fractions import Fraction
import sys
input = sys.stdin.readline
N=int(input())
mod=10**9+7
dic=defaultdict(lambda: [0,0])
c=0
d=0
e=0
for i in range(N):
 A,B = map(int,input().split())
 if A==0 and B==0:
  e+=1
 elif A==0:
  c+=1
 elif B==0:
  d+=1
 else:
  if k>0:
   dic[Fraction(A,B)][0]+=1
  else:
   dic[-1/Fraction(A,B)][1]+=1
ans=1
for k in dic:
 ans*=(pow(2,dic[k][0],mod)+pow(2,dic[k][1],mod) -1)
 ans%=mod
ans*=(pow(2,c,mod)+pow(2,d,mod)-1)
print((ans-1+e)%mod)


### FIXED CODE ###

from collections import defaultdict
from math import gcd
import sys
input = sys.stdin.readline
N=int(input())
mod=10**9+7
dic=defaultdict(lambda: [0,0])
c=0
d=0
e=0
for i in [0]*N:
 A,B = map(int,input().split())
 if A==0 and B==0:
  e+=1
 elif A==0:
  c+=1
 elif B==0:
  d+=1
 else:
  g=gcd(A,B)
  A//=g
  B//=g
  if A*B>0:
   dic[(abs(A),abs(B))][0]+=1
  else:
   dic[(abs(B),abs(A))][1]+=1
ans=1
for k in dic:
 ans=ans*(pow(2,dic[k][0],mod)+pow(2,dic[k][1],mod) -1)
ans=ans*(pow(2,c,mod)+pow(2,d,mod)-1)
print((ans-1+e)%mod)
n,k = map(int,raw_input().split())
l = []
s = list()
for i in range(n):
    v,count = map(int,raw_input().split())
    l.append((count,v))

sorted(l, key=lambda x: x[1])

countTmp = 0
for count,v in l:
    count >= k:
        print v
        break
    countTmp = countTmp + count
    if k <= countTmp:
       print v
       break;

### FIXED CODE ###

n,k = map(int,raw_input().split())
l = []
s = list()
for i in range(n):
    v,count = map(int,raw_input().split())
    l.append((count,v))

l = sorted(l, key=lambda x: x[1])

countTmp = 0
for count,v in l:
    countTmp = countTmp + count
    if k <= countTmp:
       print v
       break
N = int(input())
for i in range(N//2, N+1):
  if N % i == 0:
    print(0, 0, 0, N//i, i, 0)
    break

### FIXED CODE ###

L = 10 ** 9
N = int(input())
y = (N - 1) // L + 1
x = (L - N) % L
print(0, 0, L, 1, x, y)
H1, M1, H2, M2, K = map(int, input())
print((H2-H1) * 60 - K)

### FIXED CODE ###

H1, M1, H2, M2, K = map(int, input().split())
print((H2 - H1) * 60 + (M2 -M1) - K)
S = input()
print(S.count(1))

### FIXED CODE ###

S = input()
print(S.count("1"))