#include <bits/stdc++.h>

using namespace std;

#define int long long

const int mod = 1e9 + 7;

typedef pair<int, int> ii;
map<ii, int> mp;

int n;
ii a[200001];
int pow_2[200001];

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	pow_2[0] = 1;
	for (int i = 1; i <= 200000; i++)
		pow_2[i] = pow_2[i - 1] * 2 % mod;
	cin >> n;
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i].first >> a[i].second;
		if (!a[i].first && !a[i].second)
			(ans += 1) %= mod;
		else if (!a[i].first)
			mp[ii(0, 1)]++;
		else if (!a[i].second)
			mp[ii(1, 0)]++;
		else
		{
			int g = __gcd(a[i].first, a[i].second);
			int x, y;
			x = a[i].first / g, y = a[i].second / g;
			if (y < 0)
			{
				x *= -1;
				y *= -1;
			}
			mp[ii(a[i].first / g, a[i].second / g)]++;
		}		
	}
	int cur = (pow_2[mp[ii(1, 0)]] + pow_2[mp[ii(0, 1)]] - 1)%mod;
	for (int i = 1; i <= n; i++)
		if (a[i].first && a[i].second)
		{
			int g = __gcd(a[i].first, a[i].second);
			int x, y;
			x = a[i].first / g, y = a[i].second / g;
			if (y < 0)
			{
				x *= -1;
				y *= -1;
			}
			int tmp = pow_2[mp[ii(x, y)]];
			mp[ii(x, y)] = 0;
			x = -a[i].second / g, y = a[i].first;
			if (y < 0)
			{
				x *= -1;
				y *= -1;
			}
			(tmp += pow_2[mp[ii(x, y)]]) %= mod;
			mp[ii(x, y)] = 0;
			tmp = (tmp - 1 + mod)%mod;
			(cur *= tmp) %= mod;
		}
	cout << ((ans + cur)%mod - 1)%mod;	
}