//  __      __       .__           .____________                   __________        __ ________   __                 
// /  \    /  \ ____ |_________  __| _\______   \__ __  ____  _____\______   \__ ___/  |\_____  \ |  | ______  ___.__.
// \   \/\/   _/ __ \|  \_  __ \/ __ | |    |  _|  |  \/ ___\/  ___/|    |  _|  |  \   __/   |   \|  |/ \__  \<   |  |
//  \        /\  ___/|  ||  | \/ /_/ | |    |   |  |  / /_/  \___ \ |    |   |  |  /|  |/    |    |    < / __ \\___  |
//   \__/\  /  \___  |__||__|  \____ | |______  |____/\___  /____  >|______  |____/ |__|\_______  |__|_ (____  / ____|
//        \/       \/               \/        \/     /_____/     \/        \/                   \/     \/    \/\/     

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define ff first
#define ss second
#define PI 3.14159265358979323846
#define endl '\n'

using namespace std;

void solve()
{
    int n;
    cin >> n;
    int zc = 0;
    map <pair <ll, ll> , pair <int, int> > m;
    for(int i = 0; i < n; i++)
    {
        ll a, b;
        cin >> a >> b;
        if(a == 0 && b == 0)
            zc += 1;
        else if(a == 0)
            m[{0, 1}].ff += 1;
        else if(b == 0)
            m[{1, 0}].ss += 1;
        else
        {
            ll g = __gcd(a, b);
            a /= g, b /= g;
            if((a > 0 && b > 0) || (a < 0 && b < 0))
                m[{a, b}].ff += 1;
            else m[{abs(b), abs(a)}].ss += 1;
        }
    } 
    ll inf = 1e9 + 7, pow2[n + 1];
    pow2[0] = 1;
    for(int i = 1; i <= n; i++)
        pow2[i] = (pow2[i - 1] * 2) % inf;
    ll ans = 1;
    for(auto i : m)
    {
        auto v = i.ss;
        ll m = (pow2[v.ff] + pow2[v.ss] - 1) % inf;
        ans = (m * ans) % inf;
    }
    cout << (ans + zc - 1 + inf) % inf << endl;
}

int main()
{
	int q = 1;
	//scanf("%d", &q);
	for(int i = 1; i <= q; i++)
	{
		solve();
	}
	return 0;
}