#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 2e5 + 5;
const int mod = 1e9 + 7;
int n, a[M], b[M], pw[M], ze;

pair <int, int> reduce(int x, int y)
{
	int g = __gcd(x, y);
	x /= g, y /= g;
	if(y < 0)
		x *= -1, y *= -1;
	if(x == 0)
		return {0, 1};
	if(y == 0)
		return {1, 0};
	return {x, y};
}

pair <int, int> opp(pair <int, int> p)
{
	return reduce(-p.second, p.first);
}
 
int32_t main() 
{
	ios_base::sync_with_stdio(0);	cin.tie(0);	cout.tie(0);
	pw[0] = 1;
	for(int i = 1; i < M; i++)
		pw[i] = (2LL * pw[i - 1]) % mod;
	cin >> n;
	map <pair <int, int>, int> mp, vis;
	for(int i = 0; i < n; i++)
	{
		cin >> a[i] >> b[i];
		if(a[i] == 0 && b[i] == 0)
			ze++;
		mp[reduce(a[i], b[i])]++; 
	}
	int ans = 1;
	for(auto &i : mp)
	{
		if((i.first.first == 0 && i.first.second == 0) || vis.count(i.first))	continue;
		vis[i.first] = 1;
		pair <int, int> p = opp(i.first);
		vis[p] = 1;
		int cur = pw[i.second] + pw[mp[p]] - 1;
		ans = (ans * cur) % mod;
	}
	ans = (ans + ze - 1) % mod;
	cout << ans;
    	return 0;
}