#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100005
#define INF 1000000005
#define PI 3.1415926535897
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 1000005;
const int MOD = 1000000007;int modPow(long long a, long long n) {
    if(n==0)return 1;
  if (n == 1) return a % MOD;
  if (n % 2 == 1) return (a * modPow(a, n - 1)) % MOD;
  long long t = modPow(a, n / 2);
  return (t * t) % MOD;
}

int main(){
    int n;
    cin>>n;
    vector<ll>a(n),b(n);
    REP(i,n){
        ll x,y;
        cin>>x>>y;
        ll t=__gcd(abs(x),abs(y));
        x/=t;
        y/=t;
        if(y<0){
            x=-x;
            y=-y;
        }
        a[i]=x;
        b[i]=y;
    }
    map<pair<ll,ll>,int>m;
    REP(i,n){
        m[{a[i],b[i]}]++;
        P s;
        if(a[i]<=0)s={b[i],-a[i]};
        else s={-b[i],a[i]};
        m[s];
    }
    ll ans=1;
    for(auto p:m){
        if(p.second==-1||p.first==make_pair(0LL,0LL))continue;
        ll a=p.first.first;
        ll b=p.first.second;
        P s;
        if(a<0)s={b,-a};
        else s={-b,a};
        int x=m[s];
        int y=p.second;
        ans*=((modPow(2,x)+modPow(2,y)-1)%MOD);
        ans%=MOD;
        m[s]=m[p.first]=-1;
    }
    ans--;
    ans+=m[{0,0}];
    ans%=MOD;
    OUT(ans);
    return 0;
}