#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define fi first
#define se second
#define pi 3.141592653589793
#define mod 1000000007
#define pb push_back
#define all(v) v.begin(),v.end()
#define tc int t;cin>>t;while(t--)
#define pqmax priority_queue<int>
#define pqmin priority_queue<int,vi,greater<int>>
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define tc_g int tt;cin>>tt;for(int ti=1;ti<=tt;ti++)
#define case_g "Case #"<<ti<<": "
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, int, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_map;

int main() {
	fast_io;
	int N;
	cin >> N;
	ll pow2[N + 1];
	pow2[0] = 1;
	for (int i = 1;i <= N;i++)
		pow2[i] = pow2[i - 1] * 2 % mod;
	map<pll, int> p, n;
	for (int i = 0;i < N;i++) {
		ll a, b;
		cin >> a >> b;
		bool pos = 1;
		if (a < 0) {
			a = abs(a);
			pos = !pos;
		}
		if (b < 0) {
			b = abs(b);
			pos = !pos;
		}
		ll g = __gcd(a, b);
		a /= g;
		b /= g;
		if (pos)
			p[{a, b}]++;
		else
			n[{a, b}]++;
	}
	ll ans = 1;
	for (auto x : p) {
		int a = x.se;
		int b = n[{x.fi.se, x.fi.fi}];
		N -= (a + b);
		ans = ans * (pow2[a] + pow2[b] - 1) % mod;
	}
	ans = ans * pow2[N] % mod;
	cout << (ans + mod - 1) % mod << '\n';
}
