#include<bits/stdc++.h>

using namespace std;

using ll = long long int;
using vi = vector<int>;
#define f(n) for(int i = 0; i < n; i++)
#define fj(n) for(int j = 0; j < n; j++)
#define fk(n) for(int k = 0; k < n; k++)
#define ci(n) cin >> n;
#define ic(n) int n; cin >> n;
#define lc(n) int n; cin >> n;
#define all(a) a.begin(), a.end()
#define pri(a, n) for(int i = 0; i < n; i++) cout << a[i] << " "; cout << "\n";
#define scl(a, n) ll a[n] = {0}; for(int i = 0; i < n; i++) cin >> a[i];
#define pb push_back
#define eb emplace_back
#define int long long
#define sc second
#define ft first
void prip(int a[], int n){f(n) cout << a[i] << ' '; cout << '\n';}
const int inf = 4e18, maxn = 100000, mod = 1e9 + 7;

int bp(int a, int n)
{
    if(n == 0) return 1ll;
    if(n & 1) return (a * bp(a, n - 1)) % mod;
    int res = bp(a, n >> 1ll);
    return (res * res) % mod;
}


int gcd(int a, int b)
{
    if(b == 0) return a;
    return gcd(b, a % b);
}
main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ic(n)
    int a[n], b[n];
    int a0 = 0, b0 = 0;
    map<pair<int, int>, int> mp, usd;
    f(n)
    {
        cin >> a[i] >> b[i];
        if(a[i] == 0 && b[i] != 0) a0++;
        if(a[i] != 0 && b[i] == 0) b0++;
        if(a[i] != 0 && b[i] != 0)
        {
            int g = gcd(a[i], b[i]);
            a[i] /= g, b[i] /= g;
            if(b[i] < 0) a[i] *= -1, b[i] *= -1;
            mp[{a[i], b[i]}]++;
        }
    }
    int ans = (bp(2, a0) + bp(2, b0) - 1) % mod;
    for(pair<pair<int, int>, int> p : mp)
    {
        if(usd[p.ft]) continue;
        pair<int, int> cp = p.ft;
        //cout << cp.ft << ' ' << cp.sc << '\n';
        pair<int, int> u = {-cp.sc, cp.ft};
        if(u.sc < 0) u.sc *= -1, u.ft *= -1;
        if(mp[u] && usd[u] == 0 && usd[p.ft] == 0)
        {
            ans = (ans * (bp(2, p.sc) + bp(2, mp[u]) - 1)) % mod;
            usd[u] = 1;
        }
        else if(mp[u] == 0)
        {
            ans = (ans * bp(2, p.sc)) % mod;
        }
        usd[cp] = 1;
    }
    cout << (ans - 1 + mod) % mod;
}
