#include<bits/stdc++.h>
using namespace std;
#define db double
#define LL __int128
#define P pair<LL, LL>
#define fs first
#define sc second
#define mk make_pair
const int N = 2e5 + 11;
const int mod = 1e9 + 7;
int n, ans, mi[N];
int a[N], b[N], tot;
int f[N][2];
map<P, int> mp;
P nd[N];
bool mark[N];
int sign(db x){
    if(fabs(x) <= 1e-10)return 0;
    else return x < 0 ? -1 : 1;
}
LL operator * (P a, P b){
    return a.fs * b.fs + a.sc * b.sc;
}
bool cmp(P a, P b){
    return a.fs * b.sc - a.sc * b.fs >= 0;
}
int main(){
    cin>>n;
    long long x, y;
    int cnt = 0, ans = 0;
    mi[0] = 1;
    for(int i = 1;i <= n; i++){
        mi[i] = mi[i-1] * 2 % mod;
        scanf("%lld%lld", &x, &y);
        if(!x && !y){
            ans++;
            continue;
        }
        LL g = __gcd(abs(x), abs(y));
        x /= g; y /= g;
        if(x < 0){
            x = -x; y = -y;
        }
        if(x == 0)y = abs(y);
        mp[mk(x, y)]++;
        nd[++cnt] = mk(x, y);
    }
    sort(nd + 1, nd + 1 + cnt);
    cnt = unique(nd + 1, nd + 1 + cnt) - (nd + 1);
    sort(nd + 1, nd + 1 + cnt, cmp);
    /*for(int i = 1;i <= cnt; i++){
        long long x = nd[i].fs, y = nd[i].sc;
        printf("i=%d x=%lld y=%lld\n", i, x, y);
    }*/
    int l = 1, r = 1;
    while(l <= cnt){
        if(mark[l]){
            l++; continue;
        }
        while(nd[l] * nd[r] > 0 && r <= cnt){
            r++;
        }
        //printf("l=%d r=%d\n", l, r);
        tot++; a[tot] = mp[nd[l]];         
        if(nd[l] * nd[r] == 0 && r <= n)mark[r] = 1, b[tot] = mp[nd[r]];
        l++;
    }
    //puts("XBX");
    int sum = 1;
    for(int i = 1;i <= tot; i++){
        sum = 1LL * (mi[a[i]] + mi[b[i]] - 1) * sum % mod;
        //printf("i=%d a=%d b=%d\n", i, a[i], b[i]);
    }
    ans = (ans + sum - 1) % mod;
    cout<<ans<<endl;
    return 0;
}
