//	ZapZu's code hohoho
//	#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define dfs_black 1
#define dfs_white -1
#define pr pair
#define vt vector
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef double db;
typedef long long li;
typedef long double ld;

typedef pr<int, int> ii;
typedef pr<ld,ld> dd;

typedef vt<int> vi;
typedef vt<li> vli;
typedef vt<ld> vld;
typedef vt<ii> vii;

typedef map<int, int> mii;
typedef map<int, bool> mib;
typedef map<int, char> mic;

typedef set<int> s_i;
typedef set<char> s_c;

const int MOD = 1e9+7;
const li INF = 1e18;
const ld PI = 4*atan((ld)1);
map<ii, int> cnt;
li binpow(int a, int b)
{
	if(b==0) return 1;
	int temp=binpow(a, b/2);
	if(b%2) return (temp*temp%MOD)*a%MOD;
	return temp*temp%MOD;
}
ii modif(ii x)
{
	if(x.se<0) 
	{
		x.fi*=-1;
		x.se*=-1;
	}
	return x;
}
ii get_inv(ii x)
{
	if(x==mp(0, 1)) return {-1, 0};
	if(x==mp(-1, 0)) return {0, 1};
	else return modif({-x.se, x.fi});
}
signed main()
{
//	freopen(".inp", "r", stdin);
//	freopen(".out", "w", stdout);
	int n;
	cin>>n;
	for(int i=1; i<=n; i++)
	{
		int a, b;
		cin>>a>>b;
		int d=__gcd(a, b);a/=d;b/=d;
		if(!a and b) cnt[{0, 1}]++;
		else if(a and !b) cnt[{-1, 0}]++;
		else cnt[modif({a, b})]++;
	}
	int ans=1; set<ii> us;
	ans=ans*(cnt[{0, 0}]+1)%MOD;
	us.insert({0, 0});
	for(auto temp: cnt)
	{
		if(us.count(temp.fi)) continue;
		ii a=temp.fi, b=get_inv(temp.fi);
		ans=ans*((binpow(2, cnt[a])+binpow(2, cnt[b])-1)%MOD)%MOD;
		us.insert(a);
		us.insert(b);
	}
	ans--;
	while(ans<0) ans+=MOD;
	cout<<ans;
}


