#include <iostream>
#include <numeric>
#include<cmath>
#include <map>

using ll = long long;

constexpr int MOD = 1e9+7;
ll powof2(int r)
{
    ll a = 1;
    while (r--)
    {
        a = (a << 1) % MOD;
    }
    return a;
}


int main()
{
    int N;
    std::cin >> N;

    int nop_count = 0;
    std::map<std::pair<ll,ll>,int> g;
    for (int i = 0; i < N; i++)
    {
        ll a, b;
        std::cin >> a >> b;

        if (a == 0 && b == 0)
        {
            ++nop_count;
            continue;
        }

        ll l;
        if (a == 0)
            l = std::abs(b);
        else if (b == 0)
            l = std::abs(a);
        else
            l = std::gcd(a, b);

        a /= l;
        b /= l;
        
        if (a < 0 || (a == 0 && b < 0))
        {
            a = -a;
            b = -b;
        }
        
        g[{a, b}]++;
    }

    ll ans = 1;
    for (auto p : g)
    {
        if (auto it = g.find({p.first.second, -p.first.first}); it != g.end() && p.first.second > 0)
        {
            ll mm = (powof2(p.second) + powof2(it->second) - 1) % MOD;
            ans = (ans * mm) % MOD;
        }
        else if (auto it = g.find({-p.first.second, p.first.first}); it != g.end())
        {
            // skip
        }
        else
        {
            ll mm = powof2(p.second);
            ans = (ans * mm) % MOD;
        }
    }
    ans = (ans + nop_count - 1) % MOD;

    std::cout << ans << std::endl;
}

