#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <set>
#include <map>
#include <utility>
#define N 200020
#define MOD 1000000007
using namespace std;

long long a[N], b[N];
map<pair<long long, long long>, int> f;
set<pair<long long, long long> > u;

int Power(int x, int y)
{
    int o;

    for(o = 1; y; y >>= 1)
    {
        if(y & 1)
            o = (long long)o * x % MOD;
        x = (long long)x * x % MOD;
    }

    return o;
}

int main(void)
{
    int n;
    int i, o;
    long long g;
    map<pair<long long, long long>, int>::iterator t;
    pair<long long, long long> v;

    scanf("%d", &n);
    for(i = 0; i < n; i ++)
    {
        scanf("%lld %lld", &a[i], &b[i]);
        if(!a[i] && !b[i])
            f[make_pair(0, 0)] ++;
        else if(!a[i])
            f[make_pair(0, 1)] ++;
        else if(!b[i])
            f[make_pair(1, 0)] ++;
        else
        {
            g = __gcd(abs(a[i]), abs(b[i]));
            a[i] /= g;
            b[i] /= g;
            if(b[i] < 0)
            {
                a[i] = -a[i];
                b[i] = -b[i];
            }
            f[make_pair(a[i], b[i])] ++;
        }
    }

    u.insert(make_pair(0, 0));
    for(t = f.begin(), o = 1; t != f.end(); ++ t)
    {
        v = t -> first;
        if(!u.count(v))
        {
            swap(v.first, v.second);
            v.first = -v.first;
            if(v.second < 0)
            {
                v.first = -v.first;
                v.second = -v.second;
            }
            u.insert(v);
            // printf("fetch [%d,%d] <-> [%d,%d]\n", t->first.first,t->first.second,v.first,v.second);
            o = (long long)o * (Power(2, t -> second) + Power(2, f[v]) - 1) % MOD;
        }
    }
    o = (o + f[make_pair(0, 0)]) % MOD;
    printf("%d\n", (o + MOD - 1) % MOD);

    return 0;
}
