#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const long long MOD = 1000000007;

long long mul(long long a, long long b)
{
	return (a % MOD) * (b % MOD) % MOD;
}

long long add(long long a, long long b)
{
	return (a % MOD + b % MOD) % MOD;
}

long long sub(long long a, long long b)
{
	return (a % MOD + MOD - b % MOD) % MOD;
}

pair<ll, ll> norm(pair<ll, ll> p)
{
	ll gcd = __gcd(p.first, p.second);
	p.first /= gcd;
	p.second /= gcd;
	if (p.first == 0) {
		p.second = 1;
	} else if (p.second == 0) {
		p.first = 1;
	} else if (p.second < 0) {
		p.first = -p.first;
		p.second = -p.second;
	}
	return p;
}

pair<ll, ll> rev(pair<ll, ll> p)
{
	return norm(make_pair(-p.second, p.first));
}

int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin >> n;
	vector<long long> p2(n);
	p2[0] = 1;
	for (int i = 1; i < n; i++) p2[i] = 2 * p2[i - 1] % MOD;
	int z = 0;
	map<pair<ll, ll>, pair<ll, ll>> cn;
	for (int i = 0; i < n; i++) {
		pair<ll, ll> p;
		cin >> p.first >> p.second;
		if (p.first == 0 && p.second == 0) {
			z++;
			continue;
		}
		p = norm(p);
		cn[p].first++;
		cn[rev(p)].second++;
	}

	long long res = 1;
	map<pair<ll, ll>, bool> skip;
	for (auto &p : cn) {
		if (skip[p.first]) continue;
		skip[rev(p.first)] = true;
		long long all = sub(add(p2[p.second.first], p2[p.second.second]), 1);
		res = mul(res, all);
	}

	cout << res - 1 + z << '\n';

	return 0;
}