#include<bits/stdc++.h>
using namespace std;

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef pair<ll,ll> lll;

const ll MOD = 1000000007;
const ll INF = 1e9+5;
const double eps = 1e-7;
const double PI = acos(-1.0);

#define FOR(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define RFOR(i,a,b) for(long long i = (long long)(a); i >= (long long)(b); i--)
#define ull unsigned long long
#define deb(x )     cerr << #x << " = "<< x << endl;
#define endl    "\n"
#define coud(a,d) cout << fixed << showpoint << setprecision(d) << a;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define fill(x, y) memset(x, y, sizeof(y))
#define all(x) (x).begin(), (x).end()
#define bitcount(x) __builtin_popcount(x)
#define cps CLOCKS_PER_SEC
#define verify(x) if(x >= MOD) x -= MOD;

inline void debug_vi(vi a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void debug_vll(vll a) {FOR(i, 0, a.size()) cout<<a[i]<<" ";}
inline void print_case(int tn) {cout<<"Case #"<<tn<<": ";}

template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

template<typename T>
using maxpq = priority_queue<T>;
/*----------------------------------------------------------------------*/

//return x^y mod p
ll power(ll x,ll y, ll p)
{
    ll res = 1;     
    x = x % p; 
 
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
 
        y = y>>1; // y = y/2
        x = (x*x) % p;  
    }
    return res;
}

int main(){
    std::ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n; cin>>n;
    vector<lll> arr(n);
    map<lll, int> cnt;
    FOR(i, 0, n) {
        cin>> arr[i].ff >> arr[i].ss;
        if(arr[i].ff || arr[i].ss) {
            ll g = __gcd(abs(arr[i].ff), abs(arr[i].ss));
            arr[i].ff /= g;
            arr[i].ss /= g;

            if(arr[i].ss < 0) {
                arr[i].ss *= -1;
                arr[i].ff *= -1;
            } else if(arr[i].ss == 0 && arr[i].ff < 0) arr[i].ff *= -1;
        }
        cnt[{arr[i].ff, arr[i].ss}]++;
    }

    // for(auto itr : cnt) {
    //     cout << itr.ff.ff << " " << itr.ff.ss << " " << itr.ss << endl;
    // }
    // cout << endl << endl << endl;

    ll res = 1;
    for(auto itr : cnt) {
        ll a, b; tie(a, b) = itr.ff;
        if(a == 0 && b == 0) continue;
        ll freq = itr.ss;
        ll reva = -b, revb = a;
        if(revb < 0) {
            revb *= -1;
            reva *= -1;
        } else if(revb == 0 && reva < 0) reva *= -1;

        if(!cnt.count({reva, revb})) {
            res *= power(2, freq, MOD);
            res %= MOD;
            continue;
        }
        if(a > reva) continue;
        // cout << a << " " << b << " " << reva << " " << revb << endl;
        ll freq2 = cnt[{reva, revb}];
        // deb(freq); deb(freq2);
        ll curr = (power(2, freq, MOD) + power(2, freq2, MOD) - 1 + MOD)%MOD;
        // cout << curr << endl;
        res *= curr; res %= MOD;
        // deb(res);
    }
    res = (res - 1 + MOD)%MOD; // choose at least one.
    cout << res;
    return 0;
}