#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#include <functional>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<ll, ll, ll, ll> tlglglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
typedef unsigned int uint;
typedef unsigned long long ull;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;
void yesno(bool ok, string yes = "Yes", string no = "No") {
    if (ok) {
        cout << yes << endl;
    } else {
        cout << no << endl;
    }
}

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

// 有理数
struct rat {
    ll numerator, denominator;

    rat(ll a = 0, ll b = 1) {
        set_v(a, b);
    }
    rat& set_v(ll a, ll b) {
        numerator = a;
        denominator = b;
        reduce();
        return *this;
    }
    inline rat reduce() {
        if (denominator < 0) {
            numerator = -numerator;
            denominator = -denominator;
        }
        ll d = gcd(numerator, denominator);
        if (d == 0) {
            numerator = 0;
            denominator = 1;
        } else {
            numerator /= d;
            denominator /= d;
        }
        return *this;
    }
    inline friend ostream& operator << (ostream& s, const rat& r) {
        s << r.numerator;
        if (r.denominator != 1) {
            s << "/" << r.denominator;
        }
        return s;
    }
    inline double to_d() const {
        return (double)numerator / denominator;
    }
    inline rat abs() {
        rat ans = *this;
        if (ans.numerator < 0) {
            ans.numerator = -ans.numerator;
        }
        return ans;
    }
    inline rat operator - () { return rat() - *this; }
    inline const rat operator = (ll a) {
        *this = rat(a);
        return *this;
    }
    inline const rat operator + (const rat& r) {
        rat ans;
        ans.numerator = numerator * r.denominator + denominator * r.numerator;
        ans.denominator = denominator * r.denominator;
        ans.reduce();
        return ans;
    }
    inline const rat operator - (const rat& r) {
        rat ans;
        ans.numerator = numerator * r.denominator - denominator * r.numerator;
        ans.denominator = denominator * r.denominator;
        ans.reduce();
        return ans;
    }
    inline const rat operator * (const rat& r) {
        rat ans;
        ans.numerator = numerator * r.numerator;
        ans.denominator = denominator * r.denominator;
        ans.reduce();
        return ans;
    }
    inline const rat operator / (const rat& r) {
        rat ans;
        ans.numerator = numerator * r.denominator;
        ans.denominator = denominator * r.numerator;
        ans.reduce();
        return ans;
    }
    inline const rat& operator += (const rat& r) { return *this = *this + r; }
    inline const rat& operator -= (const rat& r) { return *this = *this - r; }
    inline const rat& operator *= (const rat& r) { return *this = *this * r; }
    inline const rat& operator /= (const rat& r) { return *this = *this / r; }
};
inline const bool operator == (const rat& a, const rat& b) {
    return a.numerator == b.numerator && a.denominator == b.denominator;
}
inline const bool operator != (const rat& a, const rat& b) { return !(a == b); }
inline const bool operator < (const rat& a, const rat& b) {
    return a.numerator * b.denominator < a.denominator * b.numerator;
}
inline const bool operator <= (const rat& a, const rat& b) {
    return a.numerator * b.denominator <= a.denominator * b.numerator;
}
inline const bool operator > (const rat& a, const rat& b) { 
    return b < a;
}
inline const bool operator >= (const rat& a, const rat& b) {
    return b <= a;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll xzero = 0;
    ll yzero = 0;
    ll zero = 0;
    map<rat, ll> mp;
    REP(i, 0, N) {
        ll a, b;
        cin >> a >> b;
        if (a == 0 && b == 0) {
            zero++;
        } else if (a == 0) {
            xzero++;
        } else if (b == 0) {
            yzero++;
        } else {
            mp[rat(a, b)]++;
        }
    }
    Mint sum = 1;
    for (auto i = mp.begin(); i != mp.end(); i++) {
        rat r = i -> first;
        if (r < rat(0)) {
            if (mp.count((rat)-1 / r) == 0) {
                sum *= ((Mint)2).pow(i -> second);
            }
        } else {
            Mint val = ((Mint)2).pow(i -> second);
            if (mp[(rat)-1 / r] != 0) {
                val += ((Mint)2).pow(mp[(rat)-1 / r]) - 1;
            }
            sum *= val;
        }
        // cout << i -> first << " " << i -> second << " " << sum << endl;
    }
    Mint val = 0;
    if (xzero > 0) {
        val += ((Mint)2).pow(xzero);
    }
    if (yzero > 0) {
        val += ((Mint)2).pow(yzero);
    }
    if (val == 0) {
        val = 1;
    }
    sum *= val;
    cout << sum - 1 << endl;
}
