#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pll;
ll ans = 1, mod = 1000000007;
ll fp(ll b, ll p)
{
    if(!p)  return 1;
    ll res = fp(b, p >> 1);
    (res *= res) %= mod;
    if(p & 1)   (res *= b) %= mod;
    return res;
}
pll form(ll a, ll b)
{
    ll gcd = __gcd(a, b);
    a /= gcd;
        b /= gcd;
    if((a > 0 && b > 0) || (a < 0 && b < 0))
    {
        if(b > 0)   b *= -1;
        a = abs(a);
    }
    else
        a = abs(a), b = abs(b);
    return make_pair(b, a);
}
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    map<pll, ll>mp;
    vector<pll>v(n);
    for(int i = 0;i < n;++i)
    {
        ll a, b;
        cin >> a >> b;
        v[i] = {a, b};
        ++mp[form(a, b)];
    }
    for(auto &it : mp)
    {
        ll a = it.F.F, b = it.F.S;
        if(make_pair(a, b) == form(a, b))
        {
            ans *= (it.S + 1);
            ans %= mod;
            continue;
        }
        if(make_pair(a, b) < form(a, b) || mp.find(form(a, b)) == mp.end())
        {
            ll tmp = fp(2, it.S);
            if(mp.find(form(a, b)) != mp.end())
            {
                tmp += fp(2, mp[form(a, b)]);
                tmp %= mod;
                tmp--;
                tmp %= mod;
                tmp += mod;
                tmp %= mod;
            }
            (ans *= tmp) %= mod;
        }
    }
    --ans;
    ans %= mod;
    ans += mod;
    ans %= mod;
    cout << ans;
    return 0;
}
