#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
#define pb push_back
#define all(c) (c).begin(), (c).end()
//#define debug(x) cout << #x << " : " << x << endl
//#define part cout << "----------------------------------\n";
#define mp make_pair
#include <iostream>

#define fastinput                     \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

LL POW(LL x, LL y)
{
    LL ans = 1;
    LL base = x;
    while (y)
    {
        if (y & 1)
        {
            ans *= base;
            ans %= MOD;
        }
        base = base * base;
        base %= MOD;
        y = y >> 1;
    }
    return ans;
}

int main()
{
    fastinput;
    LL n, i, j, k, t, temp, tc,mult,pos,neg;
    cin >> n;
    LL a[n + 1], b[n + 1];
    //zero case
    map<pair<LL, LL>, LL> freq;
    LL cnt_both = 0;
    LL neg_trouble = 0, pos_trouble = 0;
    set<pair<LL, LL>> s;
    for (i = 1; i <= n; i++)
    {
       // debug(i);
        cin >> a[i] >> b[i];
      //  debug(a[i]);
       // debug(b[i]);
        ///////////////////////////
        if (a[i] == 0 && b[i] == 0)
        {
            cnt_both++;
            continue;
        }
        /////////////////////

        if (b[i] == 0)
        {
            neg_trouble++;
        }
        else if (a[i] == 0)
        {
            pos_trouble++;
        }
        else
        {
            if (a[i] * b[i] > 0)
            {
                //positive
                LL hcf = __gcd((LL)fabs(a[i]), (LL)fabs(b[i]));
                LL num = fabs(a[i]) / hcf;
                LL denom = fabs(b[i]) / hcf;
                freq[{num, denom}]++;
              //  cout << "increenting for " << num << " " << denom << endl;
            }
            else
            {
                //negative
                LL hcf = __gcd((LL)fabs(a[i]), (LL)fabs(b[i]));
                LL num = -fabs(a[i]) / hcf;
                LL denom = fabs(b[i]) / hcf;
                freq[{num, denom}]++;
               // cout << "increenting for " << num << " " << denom << endl;
            }
        }
       // part;
    }

    LL other = 1;

    LL ans = cnt_both;
    for (auto x : freq)
    {
        //part;
        LL num = x.first.first;
        LL denom = x.first.second;
        LL num_abs = fabs(num);
        LL denom_abs = fabs(denom);
        LL parity = 1;
        if (num * denom < 0)
        {
            parity = -1;
        }
        if (s.find({num, denom}) == s.end())
        {

            pos = x.second;
            neg = 0;
            LL num_com = (-parity) * denom_abs;
            LL denom_com = num_abs;
            if (freq.find({num_com, denom_com}) == freq.end())
            {
                neg = 0;
            }
            else
            {
                neg = freq[{num_com, denom_com}];
            }

            s.insert({num, denom});
            s.insert({num_com, denom_com});
           // debug(num);
            //debug(denom);
            //debug(num_com);
           // debug(denom_com);
           // debug(pos);
           // debug(neg);
            mult = (((POW(2, pos) + POW(2, neg)) % MOD) - 1+MOD) % MOD + 100000*MOD;
            mult %= MOD;
            if(mult<0)
            {
                LL tr=4/0;
            }
            //debug(mult);
            other *= mult;
            other %= MOD;
        }
        else
        {
           // cout << "skipping \n";
           // debug(num);
           // debug(denom);
        }

       // part;
    }

    ////////////////////////
    pos=pos_trouble;
    neg=neg_trouble;
    //debug(pos_trouble);
   // debug(neg_trouble);
    mult = (((POW(2, pos) + POW(2, neg)) % MOD) - 1) % MOD + MOD;
    mult %= MOD;
   // debug(mult);
    other *= mult;
    other %= MOD;
    //////////////////////

    other = ((other - 1) % MOD + MOD) % MOD;
    ans = (cnt_both + other) % MOD;
    //debug(ans);
    cout<<ans<<endl;

    return 0;
}
