#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

int n;
int a[N], b[N];
map<pair<int, int>, int> m;

pair<int, int> get(int i)
{
	int x = a[i], y = b[i];
	int g = __gcd(x, y);
	x /= g;
	y /= g;
	if(y < 0)
		x *= -1, y *= -1;
	if(x == 0)
		y = 1;
	if(y == 0)
		x = 0;
	return {x, y};
}

pair<int, int> opp(pair<int, int> p)
{
	int x = p.second, y = p.first;
	x *= -1;
	if(y < 0)
		x *= -1, y *= -1;
	if(x == 0)
		y = 1;
	if(y == 0)
		x = 0;
	return {x, y};
}

int32_t main()
{
	IOS;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i] >> b[i];
		m[get(i)]++;
	}
	int ans = 1;
	map<pair<int, int>, int> vis;
	for(auto &it:m)
	{
		if(vis[it.first])
			continue;
		pair<int, int> x = {0, 0};
		if(it.first == x)
		{
			ans *= (it.second + 1);
			ans %= MOD;
			continue;
		}
		pair<int, int> p = opp(it.first);
		if(m.count(p))
		{
			vis[p] = 1;
			int x = it.second, y = m[p];
			ans *= (pow(2LL, x, MOD) + pow(2LL, y, MOD) - 1);
			ans %= MOD;
		}
		else
		{
			ans *= pow(2LL, it.second, MOD);
			ans %= MOD;
		}
	}
	ans -= 1;
	ans += MOD;
	ans %= MOD;
	cout << ans;
	return 0;
}