/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>
 
// MACROS SAMPAH
#define Jehian using
#define Norman namespace
#define Saviero std
 
Jehian Norman Saviero;
 
// MACROS TYPE
typedef long l;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
 
// MACROS FOR PRINT
#define nl printf("\n")
#define sp printf(" ")
 
// MACROS FOR ATTRIBUTE
#define fi first
#define se second
 
// MACROS FOR FUNCTION AND METHOD
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ALL(x) (x).begin(), (x).end()
#define ALLN(x,n) (x), (x)+(n)
#define CUBE(x) (SQR(x)*(x))
#define SET(x,y) for (int _qwe = sizeof(x)/sizeof(x[0]); _qwe; ) x[--_qwe] = (y)
#define SQR(x) ((x)*(x))
#define SSORT(x,sz) sort(ALLN(x,sz))
#define RESET(x) memset((x), 0, sizeof(x))
#define VSORT(x) sort(ALL(x))
 
// MACROS READ INPUT
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scul(x) scl(x)
#define scull(x) scll(x)

pll adjust(pll A) {
	if (A.fi == 0) {
		return {0, 1};
	}
	if (A.se == 0) {
		return {1, 0};
	}
	ll gcd = __gcd(A.fi, A.se);
	A = {A.fi/gcd, A.se/gcd};
	return A;
}

map<pll,ll> cnt;

const ll MD = 1e9+7;
inline ll ADD(ll a, ll b) {
	a %= MD;
	b %= MD;
	return (a + b + MD) % MD;
}

inline ll MUL(ll a, ll b) {
	return (a * b) % MD;
}

inline ll powMod(ll a, ll p) {
	ll res = 1;
	for (; p; p >>= 1, a = MUL(a,a)) {
		if (p & 1) res = MUL(res,a);
	}
	return res;
}

map<pll, bool> visited;
ll xceptional = 0;

int main() {
	ll N;
	scll(N);
	for (int i = 0; i < N; ++i) {
		ll A, B;
		scll(A), scll(B);
		if (A == 0 && B == 0) ++xceptional;
		pll tmp = adjust({A, B});
		++cnt[tmp];
	}
	vector<pll> proc;
	ll asu = 0;
	for (auto &it : cnt) {
		pll curr = it.fi;
		if (visited[curr]) continue;
		visited[curr] = 1;
		ll num = it.se;
		pll anti = adjust({-curr.se, curr.fi});
		visited[anti] = 1;
		if (cnt.find(anti) != cnt.end()) {
			ll num_anti = cnt[anti];
			proc.pb({num, num_anti});
		} else {
			asu += num;
		}
	}
	ll res = 1;
	for (auto &it : proc) {
		res = MUL(res, ADD(ADD(powMod(2, it.fi)-1, powMod(2, it.se)-1),1));
	}
	res = MUL(res, powMod(2, asu));
	printf("%lld\n", ADD(ADD(res, -1), xceptional));
	return 0;
}