#include<bits/stdc++.h> 
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
const int M = 1e9 + 7;
pi norm(int a, int b) {
	int g = __gcd(a, b);
	a /= g, b /= g;
	if(a == 0) b = 1;
	if(b == 0) a = 1;
	if(a < 0) a = -a, b = -b;
	return {a, b};
}
pi inv(pi p) {
	return norm(-p.second, p.first);
}
int pw[200010];
map<pi, int> cnt, vis;
int main(void)
{
	pw[0] = 1;
	for(int i = 1; i < 2e5 + 7; i++)
		pw[i] = pw[i - 1] * 2 % M;
	int n, ans = 0;
	cin >> n;
	for(int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		if(a == 0 && b == 0) ans++;
		else {
			pi p = norm(a, b);
			cnt[p]++;
		}
	}
	ll tt = 1;
	for(auto pp:cnt){
//		ll pp=cnt[i];
		pi p = pp.first, q = inv(p);
		if(vis[p]) continue;
		tt = tt * (pw[cnt[p]] + pw[cnt[q]] - 1) % M;
		vis[p] = vis[q] = 1;
	}
	ans += tt;
	ans += M - 1;
	ans %= M;
	cout << ans << endl;
	
}