#include <iostream>
#include <algorithm>
#include <utility>
#include <map>

using namespace std;

const int MOD = 1000000007;

long long mpow(long long x, long long n) {
	if (n == 0) return 1;
	if (n & 1) return x * mpow(x * x % MOD, n >> 1) % MOD;
	return mpow(x * x % MOD, n >> 1);
}

int main() {
	int n; cin >> n;
	map<pair<long long, long long>, pair<int, int> > mp;
	int ans = 0;
	for (int i = 0; i < n; ++i) {
		long long a, b; cin >> a >> b;
		if (!a && !b) {
			++ans;
			continue;
		}
		long long g = gcd(a, b); //gcd(a,0)=gcd(0,a)=|a|
		a /= g, b /= g;
		if ((a < 0) ^ (b < 0)) ++mp[make_pair(abs(a), abs(b))].first; 
		else ++mp[make_pair(abs(b), abs(a))].second;
	}
	long long tmp = 1;
	for (auto [_, e] : mp)
		(tmp *= (mpow(2, e.first) + mpow(2, e.second) - 1 + MOD) % MOD) %= MOD;
	ans = (ans + tmp - 1 + MOD) % MOD;
	cout << ans << endl;

	return 0;
}