#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#include <self/combinatorics>
#define Endl endl
#define mp make_pair
#define ll long long 
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define quickcin ios_base::sync_with_stdio(false);
template <typename T1,typename T2> inline void chmin(T1 &x,T2 b) {if(b<x) x=b;}
template <typename T1,typename T2> inline void chmax(T1 &x,T2 b) {if(b>x) x=b;}
template <typename T1,typename T2> inline void chmod(T1 &x,T2 b) {x%=b,x+=b;if(x>=b) x-=b;}
const int inf=1039074182;
const int mod=1e9+7;
const ll llinf=1LL*inf*inf;
using namespace std;
int n;
ll a[200005];
ll b[200005];

struct s4
{
	int a[5];
};

map <pair<ll,ll>,s4> m;

int quadrant(ll x,ll y)
{
	if(y==0 && x>0) return 1;
	if(x==0 && y>0) return 2;
	if(y==0 && x<0) return 3;
	if(x==0 && y<0) return 4;
	if(x>0 && y>0) return 1;
	if(x<0 && y>0) return 2;
	if(x<0 && y<0) return 3;
	if(x>0 && y<0) return 4;
}

void zjhua(ll &x,ll &y)
{
	if(x==0 || y==0)
	{
		x=1;
		y=0;
	}
	else
	{
		while(!(x>0 && y>0))
		{
			ll tx=y,ty=-x;
			x=tx,y=ty;
		}
		ll g=__gcd(x,y);
		x/=g;
		y/=g;
	}
}

int main()
{
//	freopen("input.txt","r",stdin);
	quickcin;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i];
	}
	for(int i=0;i<n;i++)
	{
		if(a[i]==0 && b[i]==0) continue;
		ll x=a[i],y=b[i];
		zjhua(x,y);
		m[mp(x,y)].a[quadrant(a[i],b[i])]++;
	}
	int res=1;
	init(0,mod);
	for(auto tmp:m)
	{
		s4 o=tmp.second;
		int a=o.a[1],b=o.a[2],c=o.a[3],d=o.a[4];
		int ways=sub(add(fastpow(2,(a+c)),fastpow(2,(b+d))),1);
		res=mult(res,ways);
	}
	res=sub(res,1);
	cout<<res<<endl;
	return 0;
}