#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define int long long

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

typedef pair<int, int> pint;
typedef vector<int> vecint;

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front

#define MOD (1000L * 1000L * 1000L + 7L)

template<typename T>
vector<T> readArray(int N) {
    vector<T> vec(N);

    for (auto& v: vec) {
        cin >> v;
    }

    return vec;
}

template<typename T>
T read() {
    T a; cin >> a; return a;
}

int readInt() {
    int a; cin >> a; return a;
}
double readDouble() {
    double a; cin >> a; return a;
}
string readStr() {
    string a; cin >> a; return a;
}

namespace math {
    long long pow_mod(long long a, long long b, long long M) {
        long ret = 1;
        long tmp = a;

        while(b>0) {
            if((b&1)==1) ret = (ret * tmp) % M;
            tmp = (tmp * tmp) % M;
            b = b>>1;
        }

        return ret;
    }

    long long nCk(long long n, long long k, long long M) {
        long ret = 1;
        int _min = std::min(k, n-k);

        for(int i=1;i<=_min;i++) {
            ret = (ret * pow_mod(i, M-2, M)) % M;
        }
        for(int i=n-_min+1;i<=n;i++) {
            ret = (ret * i) % M;
        }

        return (long long) ret;
    }

    long long gcd(long long a, long long b) {
        if (a < b) return gcd(b, a);
        if (b == 0) return a;
        return gcd(b, a % b);
    }
}

pair<int, int> _div(int a, int b) {
    int c = math::gcd(a < 0 ? -a : a, b < 0 ? -b : b);
    a /= c;
    b /= c;

    if (b < 0) {
        a *= -1;
        b *= -1;
    }

    return mp(a, b);
}

struct hoge {
    int cnt;
    bool check;
};

void Main()
{
    int n = readInt();
    vecint a(n);
    vecint b(n);

    REP(i, n) {
        cin >> a[i] >> b[i];
    }

    map<pint, hoge> m;
    int zeros = 0;
    REP(i, n) {
        if (a[i] == 0 && b[i] == 0) {
            zeros++;
            continue;
        }

        pint p = _div(a[i], b[i]);
        if (p.first == 0) {
            p = mp(0, 1);
        } else if (p.second == 0) {
            p = mp(-1, 0);
        }

        if (m.find(p) == m.end()) {
            m[p] = hoge({
                0, false
            });
        }
        m[p].cnt++;
    }

    int ans = 1;

    for (auto &x: m) {
        if (x.second.check) continue;

        pint p = x.first;
        pint q = _div(-p.second, p.first);
        int h = math::pow_mod(2, x.second.cnt, MOD);
        if (m.find(q) != m.end()) {
            auto &y = m[q];
            y.check = true;
            h += math::pow_mod(2, y.cnt, MOD);
            h--;
        }

        ans *= h;
        ans %= MOD;
    }
    ans += zeros;
    if (ans > 0) {
        ans--;
    } else {
        ans = MOD - 1;
    }
    ans %= MOD;

    cout << ans << endl;

}

signed main() {
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();

    return 0;
}


Measured memory_bytes: 21780