#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

const int md = 1000000007;

inline int add(int a, int b) 
{
	a += b;
	if (a >= md) a -= md;
	return a;
}
inline int sub(int a, int b) 
{
	a -= b;
	if (a < 0) a += md;
	return a;
}
inline int mul(int a, int b) 
{
	return (int)((long long)a * b % md);
}
inline int po(int a, int b) 
{
	int r = 1;
	while (b) {
		if (b & 1) r = mul(r, a);
		a = mul(a, a);
		b >>= 1;
	}
	return r;
}

vector<int> g;
int n;
map<pair<long long, long long>, int> m;
vector<int> v;

int main() 
{
	for (int bit = 0; bit < 16; ++bit) 
		if (!((bit & 1) && (bit & 2)) && !((bit & 2) && (bit & 4)) && !((bit & 4) && (bit & 8)) && !((bit & 8) && (bit & 1))) g.push_back(bit);
	scanf("%d", &n);
	pair<int, int> z(0, 0);
	int both = 0;
	long long a, b;
	for (int i = 0; i < n; ++i) {
		scanf("%lld%lld", &a, &b);
		if (!a || !b) {
			if (!a && b) ++z.first;
			else if (a && !b) ++z.second;
			else ++both;
			continue;
		}
		long long gcd = __gcd(a, b);
		a /= gcd;
		b /= gcd;
		++m[make_pair(a, b)];
	}
	v.push_back(sub(po(2, z.first) + po(2, z.second), 1));
	for (map<pair<long long, long long>, int>::iterator it = m.begin(); it != m.end(); ++it) if (it->second != -1) {
		pair<long long, long long> t = it->first;
		int s[4] = {0};
		for (int i = 0; i < 4; ++i) {
			if (m.count(t)) {
				s[i] = m[t];
				m[t] = -1;
			}
			else s[i] = 0;
			t.first *= -1;
			swap(t.first, t.second);
		}
		v.push_back(0);
		for (int i = 0; i < g.size(); ++i) {
			int cur = 1;
			for (int j = 0; j < 4; ++j) if ((g[i] >> j) & 1) cur = mul(cur, sub(po(2, s[j]), 1));
			v.back() = add(v.back(), cur);
		}
	}
	int ans = 1;
	for (int i = 0; i < v.size(); ++i) ans = mul(ans, v[i]);
	printf("%d\n", sub(ans, 1) + sub(po(2, both), 1));
	return 0;
}
