#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

const int INF = 1001001001;
const int mod = 1000000007;

ll pow(ll base, ll order) {
	ll ans = 1;
	rep(i,order) ans *= base;
	return ans;
}

ll pow_mod(ll base, ll order) {
	ll ans = 1;
	rep(i,order) {
		ans *= base;
		ans %= mod;
	}
	return ans;
}

int main() {
	int n;
	cin >> n;
	map<pair<ll, ll>, pair<int, int>> remi; 
	ll zero = 0;
	rep(i,n) {
		ll a, b;
		cin >> a >> b;
		bool rot = false;
		if (a == 0 && b == 0) {
			zero++;
			continue;
		}
		else {
			ll c = gcd(a, b);
			a /= c; b /= c;
			if (a < 0) {
				a = -a;
				b = -b;
			}
			if (a == 0 && b < 0) {
				a = -a;
				b = -b;
			}
			if (b <= 0) {
				ll c = a;
				a = -b;
				b = c;
				rot = true;
			}
		}
		//cout << a << " " << b << endl;
		if (rot) remi[{a, b}].first++;
		else remi[{a, b}].second++;
	}
	ll ans = 1;
	for (auto m : remi) {
		ll s = m.second.first;
		ll t = m.second.second;
		//cout << s << " " << t << endl;
		ll tmp = 1; // choose nothing.
		tmp += pow_mod(2, s) - 1; tmp %= mod;
		//cout << "first " << tmp << endl;
		tmp += pow_mod(2, t) - 1; tmp %= mod;
		//cout << "first + second " << tmp << endl;
		ans *= tmp; ans %= mod;
	}
	ans -= 1; ans %= mod;// exclude choosing nothing.
	ans += zero; ans %= mod;
	cout << ans << endl;
	return 0;
} 