#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

const int mod = 1e9 + 7;
int n;

long long modpow(long long x, long long y){
	if(y == 0) return 1;
	long long res = modpow(x, y / 2);
	res = (res * res) % mod;
	if(y % 2) res = (res * x) % mod;
	return res;
}

long long gcd(long long a, long long b){
	if(b == 0) return a;
	else return gcd(b, a % b);
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n;
	map<pair<long long, long long>, pair<long long, long long>> mp;
	long long val = 1;
	for(int i = 0; i < n; i++){
		long long a, b;
		cin >> a >> b;
		if(a == 0 && b == 0){
			val++;
			continue;
		}else if(a == 0){
			b = 1;
			if(mp.find(make_pair(a, b)) != mp.end()) mp[make_pair(a, b)].first++;
			else if(mp.find(make_pair(b, a)) != mp.end()) mp[make_pair(b, a)].second++;
			else mp[make_pair(a, b)].first++;
		}else if(b == 0){
			a = 1;
			if(mp.find(make_pair(a, b)) != mp.end()) mp[make_pair(a, b)].first++;
			else if(mp.find(make_pair(b, a)) != mp.end()) mp[make_pair(b, a)].second++;
			else mp[make_pair(a, b)].first++;
		}
		int neg = (a / abs(a) != b / abs(b)) ? -1 : 1;
		a /= (a / abs(a)), b /= (b / abs(b));
		long long div = gcd(a, b);
		a /= div, b /= div;
		if(mp.find(make_pair(neg * -1 * a, b)) != mp.end()) mp[make_pair(neg * -1 * a, b)].first++;
		else if(mp.find(make_pair(neg * b, a)) != mp.end()) mp[make_pair(neg * b, a)].second++;
		else mp[make_pair(neg * -1 * a, b)].first++;
	}
	for(auto &i : mp){
		long long mult = ((modpow(2, i.second.first) + modpow(2, i.second.second) - 1) % mod + mod) % mod;
		val = ((val * mult) % mod + mod) % mod;
	}
	cout << val - 1 << "\n";
	return 0;
}