
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vll vector<ll>
#define vvll vector<vll>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define pii pair<int, int>
#define vpli vector<pair<long long, int>>
#define deb(x) cout << "deb " << #x << " " << x << endl
#define all(x) x.begin(), x.end()
#define endl "\n"
const int N = 2e5 + 3,MOD = 1e9+7;

int n;
vll a(N),b(N);

ll bpow(ll base,ll pow)
{
    if(pow == 0) return 1;
    ll ans = bpow(base,pow/2);
    ans = (ans*ans)%MOD;
    if(pow%2)
    {
        ans = (ans * base)%MOD;
    }
    return ans;
}

void solve()
{
    cin>>n;
    ll zeroc = 0;
    map<pair<ll,ll>,ll> mp;
    for(int i=0;i<n;i++)
    {
        cin>>a[i]>>b[i];
        if(a[i]>0 && b[i]<0)
        {
            a[i]*=-1;
            b[i]*=-1;
        }
        else if(a[i] == 0 && b[i] == 0)
        {
            zeroc++;
            continue;
        }
        ll g = __gcd(abs(a[i]),abs(b[i]));
        a[i] /= g;
        b[i] /= g;
        mp[{a[i],b[i]}]++;
    }
    for(auto x : mp)
    {
        cout<<x.first.first<<" "<<x.first.second<<" "<<x.second<<endl;
    }
    ll res = 1;
    for(auto x : mp)
    {
        ll a1 = x.first.first;
        ll b1 = x.first.second;
        ll cnt1 = x.second;
        ll a2,b2=abs(a1);
        if(a1>=0)
        {
            a2 = -b1;
        }
        else
        {
            a2 = b1;
        }
        ll cnt2 = mp[{a2,b2}];
        if(mp.find({a2,b2}) != mp.end())
        {
            mp.erase({a2,b2});
        }
        res = (res*((bpow(2,cnt1)+bpow(2,cnt2)-1+MOD)%MOD)+MOD)%MOD;
        /*
        vll deb = {a1,b1,a2,b2,cnt1,cnt2,res};
        cout<<"DEBUGGING\n";
        for(ll x : deb) cout<<x<<" ";
        */
    }
    cout<<(res-1+zeroc+MOD)%MOD<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //pre();
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
    return 0;
}
