#include <bits/stdc++.h>
using namespace std;

#define LL long long
#define pii pair<LL, LL>
#define mp make_pair

const int maxN = 2e5 + 10, mod = 1e9 + 7;

int n, pw[maxN + 1];

map<pii, int> f;

int main()
{
	scanf("%d", &n);

	pw[0] = 1;
	for(int i = 1; i <= n; i++) pw[i] = 2ll * pw[i - 1] % mod;
	
	int ans = 1, res = 0;
	for(int i = 1; i <= n; i++)
	{
		LL x, y;
		scanf("%lld %lld", &x, &y);
		if(!x && !y) { while(1); res ++; continue; }
		if(!x) { f[ mp(0, 1) ] ++; continue; }
		if(!y) { f[ mp(1, 0) ] ++; continue; }
		LL g = __gcd(x, y);
		x /= g; y /= g;
		if(x < 0) x = -x, y = -y;
		f[ mp(x, y) ] ++;
	}

	for(map<pii, int>::iterator it = f.begin(); it != f.end(); it++)
	{
		LL x = (it -> first).first, y = (it -> first).second;
		if((it -> second) == -1) continue;
		LL nx = -y, ny = x;
		if(nx < 0) nx = -nx, ny = -ny;
		int t = (pw[it -> second] + pw[ f[ mp(nx, ny) ] ] - 1) % mod;
		ans = 1ll * ans * t % mod;
		it -> second = f[ mp(nx, ny) ] = -1;
	}

	printf("%d\n", (ans + res - 1) % mod);
	return 0;
}
