#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 1000000007

using namespace std;
using ll = long long;
using ldb = long double;

long long mypow(long long k, long long n) {
	long long temp = 1;

	k = k % DIV;
	while (n) {
		if (n % 2) temp = temp * k % DIV;
		k = k * k % DIV;
		n = n / 2;
	}
	return temp % DIV;
}

ll lcd(ll p, ll q) {
	ll upper, lower, r;

	if (p >= q) upper = p, lower = q;
	else upper = q, lower = p;
	r = upper % lower;
	if (r)return lcd(lower, r);
	else return lower;
}

int main() {
	ll N; cin >> N;
	map <pair<ll,ll> , ll > mp1, mp2;

	for (int i = 0; i < N; i++) {
		ll a, b; cin >> a >> b;
		if(a==0&&b==0) mp1
		ll G = lcd(abs(a), abs(b));
		mp1[make_pair(a / G, b / G)]++;
		mp2[make_pair(b / G, a / G)]++;
	}
	ll ng = 0;
	for (auto x : mp1) {
		ll u = (mypow(2, x.second) - 1 + DIV) % DIV;
		ll v = (mypow(2, mp2[make_pair(-x.first.first,x.first.second)]) - 1 + DIV) % DIV;
		v = +(mypow(2, mp2[make_pair(x.first.first, -x.first.second)]) - 1 + DIV) % DIV;
		v %= DIV;

		ng += (((u * v) % DIV) * (mypow(2, N - x.second - mp2[make_pair(-x.first.first, x.first.second)]- mp2[make_pair(x.first.first, -x.first.second)]))) % DIV;
		ng %= DIV;

		cout << "u=" << u << " v=" << v << " ng=" << ng << endl;
		//mp1[x.first] = 0, mp2[x.first] = 0;
	}
	cout << (mypow(2, N) - ng - 1 + DIV) % DIV << endl;
}
