#include<bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> set_t;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define SUM(v) accumulate(v.begin(),v.end(),lli(0))
#define rev(n,d) for(int i=n;i>=d;i--)
#define FOR0(n) for(int i=0;i<n;i++)
#define FOR(a,n) for(int i=a;i<n;i++)
#define FORQ(a,n) for(int i=a;i<=n;i++)
#define inf 1000000009
#define inff 0x3f3f3f3f
#define sz(a) int((a).size())
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define endl "\n"
#define mod 1000000007
#define mem(ar,x) memset(ar,x,sizeof ar)
#define present(container, element) (container.find(element) != container.end())
#define max3(a,b,c) return (lli(a)>lli(b)?(lli(a)>lli(c)?a:c):(lli(b)>lli(c)?b:c))
#define max4(a,b,c,d) return (max3(a,b,c)>lli(d)?(max3(a,b,c)):d)
#define min3(a,b,c) return (lli(a)<lli(b)?(lli(a)<lli(c)?a:c):(lli(b)<lli(c)?b:c))
#define min4(a,b,c,d) return (max3(a,b,c)<lli(d)?(max3(a,b,c)):d)
typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<int,pii>ppii;
typedef vector<int>vi;
typedef vector<vi>vvi;
typedef vector<pii>vpii;
const int N=100005;
lli power(lli x, lli y)
{
    lli res = 1;   
    x = x % mod; 
    while (y > 0)
    {
        if (y & 1)
            res = (1LL*res*x) % mod;
 
        y = y>>1;
        x = (1LL*x*x) % mod;
    }
    return res;
}
 

lli inv(lli n)
{
    return power(n,mod-2);
}
int dr8[]={0,0,1,-1,1,1,-1,-1};
int dc8[]={1,-1,0,0,-1,1,-1,1};
int dr4[]={0,1,-1,0};
int dc4[]={1,0,0,-1};
int main(){
	fast
	lli n,x,y;
	cin>>n;
	map<pair<lli,lli>,lli >m;
	lli bz=0,fz=0,sz=0;
	FOR0(n){
		cin>>x>>y;
		if(x==0&&y==0) bz++;
		else if(x==0) fz++;
		else if(y==0) sz++;
		else{
			if(y<0){
				x=-x;y=-y;
			}
			lli g=__gcd(x,y);
			x/=g;y/=g;
			m[{x,y}]++; 
		}
	}
	lli an=(power(2,fz)+power(2,sz)-1+mod)%mod;
	map<pair<lli,lli>,lli>::iterator it=m.begin();
	for(;it!=m.end();it++){
		lli f=it->ff.ss,s=it->ff.ff;
		s=-s;
		lli t=it->ss;
		lli comp=0;
		if(m.find({f,s})!=m.end()){
			comp=m[{f,s}];
			m[{f,s}]=0;
		}
		an=(an*((power(2,comp)+power(2,t))%mod-1+mod)%mod)%mod;
		it->ss=0;
	}
	an=(an-1+mod)%mod;
	an=(an+bz)%mod;
	cout<<an<<endl;
}

