#include <iostream>
#include<map>
#include<cstdlib>
typedef long long ll;
using namespace std;
ll n, cnt00 = 0,cnta0=0,cntb0=0;
double a, b;
const ll p = 1000000007;
void ins(map<double,pair<ll,ll>>& m, double a,double b) {
	double k1 = floor(a/b*1e18);
	double k2 = floor(-b/a*1e18);
	if (m.count(k1) == 0) {
		if (m.count(k2) == 0) {
			if (abs(a / b) > 1) {
				m[k1].first = 1;
				m[k1].second = 0;
			}
			else {
				m[k2].first = 0;
				m[k2].second = 1;
			}
		}
		else m[k2].second++;
	}
	else m[k1].first++;
}
ll pow2(ll k) {
	ll c = 2;
	ll f = 1;
	for (ll bit = 1; bit <= k; bit <<= 1) {
		if (k & bit)f = f * c % p;
		c = c * c % p;
	}
	return f;
}
int main() {
	//cout << (1264561.0 / 497651967616.0-1264561.0 v* 12345678.0 / (497651967616.0 * 12345678.0)<1e-40?"Yes":"No") << "\n";
	cin >> n;
	map<double, pair<ll, ll>> line_map;
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		if (b == 0) {
			if (a == 0)cnt00++;
			else cntb0++;
		}
		else if (a == 0) {
			cnta0++;
		}
		else ins(line_map, a, b);
	}
	ll ans = 1;
	for (auto i = line_map.begin(); i != line_map.end(); ++i) {
		ll& cnt1 = i->second.first;
		ll& cnt2 = i->second.second;
		ans = (ans * (pow2(cnt1)+pow2(cnt2) - 1)+ p) % p;
	}
	ans = (ans * (pow2(cnta0) + pow2(cntb0) - 1)-1 +cnt00+ p) % p;
	cout << ans;
}