#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

//マクロ
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second



int main(int argc, char const *argv[])
{
    int n;
    cin >> n;
    // itmのkeyのfirstはa_i, secondはb_i valueは出現回数
    map<pair<ll,ll>, ll> itm;
    
    REP(i,n)
    {
        int a,b;
        cin >> a >> b;
        if (a == 0 && b == 0) continue;
        
        else if (a == 0)
        {
            itm[make_pair(0,1)]++;
        } else if (b == 0)
        {
            itm[make_pair(1,0)]++;
        } else
        {
        int gcd = __gcd(a,b);
        a = a / gcd;
        b = b / gcd;
        if (a > 0)
            itm[make_pair(a,b)]++;
        else 
            itm[make_pair(-a,-b)]++; 
        }
        
    }

    // for (auto pir : itm)
    // {
    //     cout << "input pair (" << pir.F.F << "," << pir.F.S << ") and num is " << pir.S << endl;
    // }
    // bad_pairは含まれては行けない組のペアの個数をカウントする.
    set<pair<ll,ll>> bad_pair;
    for (auto pir : itm)
    {
        ll a = pir.F.F, b = pir.F.S, num = pir.S;
        if (num == 0) continue;
        pair<ll,ll> search_pair;
        if (b > 0)
            search_pair = make_pair(b,-a);
        else
            search_pair = make_pair(-b,a);

        ll search_num = itm[search_pair];
        // cout << "now pair (" << a << "," << b << ") search pair (" << search_pair.F << "," << search_pair.S << ")" << endl;
        // cout << "search num is " << search_num << endl;
        if (search_num != 0)
            bad_pair.insert(make_pair(min(num, search_num), max(num, search_num)));
    }

    ll ans = 1;
    ll bad_itm = 0;
    for (auto pir : bad_pair)
    {
        ans *= pow(2,pir.F) + pow(2,pir.S) - 1;
        ans %= MOD;
        bad_itm += pir.F + pir.S;
    }

    ll res = pow(2, n - bad_itm) * ans - 1;
    res %= MOD;
    // cout << "res is " << res << " ans is " << ans << " bad_itm is " << bad_itm << endl;
    cout << res << endl;
    return 0;
}
