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

//https://atcoder.jp/contests/abc168/tasks/abc168_e

//mod
const int mod = 1e9 + 7;
int pow(int x, int y) { //x^y
	int rv = 1;
	for (; y > 0; y >>= 1, x = (long long) x * x % mod)
		if (y & 1)
			rv = (long long) rv * x % mod;
	return rv;
}
int inverce(int x) {
	return pow(x, mod - 2);
}

int n, z = 0;
map<pair<long long, long long>, pair<int, int>> m;
long long ans = 1;

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		long long a, b;
		cin >> a >> b;
		if (!(a || b)) {
			z++;
			continue;
		}
		int g = gcd(a, b);
		a /= g, b /= g;
		if (b < 0)
			a *= -1, b *= -1;
		if (a > 0)
			m[make_pair(a, b)].first++;
		else
			m[make_pair(b, -a)].second++;
	}
	for (auto &p : m) {
		ans = ans * (pow(2, p.second.first) + pow(2, p.second.second) - 1);
	}
	ans = (ans + z - 1) % mod;
	if (ans < 0)
		ans += mod;
	cout << ans << endl;
}
