#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vi2;
typedef vector<vi2> vi3;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef vector<vll> vll2;
typedef vector<vll2> vll3;
typedef vector<bool> vb;

#define el '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repi(i, a, b) for (int i = a; i >= b; i--)
#define umap unordered_map
#define uset unordered_set
#define vec vector
#define loop(a) for (auto &x : a)
#define all(a) a.begin(), a.end()
#define mp make_pair

const ll MODULO = 1e9 + 7;

ll gcd(ll a, ll b) {
    if (a == 0 || b == 0) {
        return a + b;
    } else if (a > b) {
        return gcd(a % b, b);
    } else {
        return gcd(a, b % a);
    }
}

struct Fraction {
    ll x, y;
    int sign;

    Fraction(ll x0, ll y0) : x(x0), y(y0) {
        ll g = gcd(abs(x), abs(y));
        x /= g;
        y /= g;
        if (x < 0 && y < 0) {
            x = -x;
            y = -y;
        }
        if (x < 0 || y < 0) {
            sign = -1;
            x = abs(x);
            y = abs(y);
        } else {
            sign = 1;
        }
    }

    // 有序即可，不需要真小于。
    bool operator<(const Fraction &other) const {
        return sign < other.sign ||
               (sign == other.sign && mp(x, y) < mp(other.x, other.y));
    }
};

void add_self(ll &a, ll b) {
    a += b;
    if (a >= MODULO) {
        a -= MODULO;
    }
}

ll mul(ll a, ll b) {
    return a * b % MODULO;
}

ll power(int base, int exp) {
    if (exp == 0) {
        return 1;
    }
    if (exp == 1) {
        return base;
    }
    ll half = power(base, exp / 2);
    if (exp % 2 == 0) {
        return mul(half, half);
    } else {
        return mul(base, mul(half, half));
    }
}

ll sub(ll a, ll b) {
    a -= b;
    if (a < 0) {
        a += MODULO;
    }
    return a;
}

void sub_self(ll &a, ll b) {
    a = sub(a, b);
}

void mul_self(ll &a, ll b) {
    a = mul(a, b);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n0, n = 0;
    cin >> n0;
    vll a, b;
    rep(i, 0, n0) {
        ll aa, bb;
        cin >> aa >> bb;
        if (aa == 0 && bb == 0) {
            continue;
        }
        a.push_back(aa);
        b.push_back(bb);
        n++;
    }
    int a0_cnt = 0, b0_cnt = 0;
    map<Fraction, int> cnt;
    repi(i, n - 1, 0) {
        if (a[i] == 0) {
            a0_cnt++;
        } else if (b[i] == 0) {
            b0_cnt++;
        } else {
            cnt[Fraction(a[i], b[i])]++;
        }
    }
    set<Fraction> used;
    ll ans = 1;
    for (auto [f, c] : cnt) {
        if (used.count(f)) {
            continue;
        }
        Fraction f1((-f.sign) * f.y, f.x);
        used.insert(f1);
        used.insert(f);
        int c1 = cnt[f1];
        // 有f没f1；
        ll ans1 = sub(power(2, c), 1);
        // 没f有f1；
        add_self(ans1, sub(power(2, c1), 1));
        // 没f没f1
        add_self(ans1, 1);
        mul_self(ans, ans1);
    }
    // 处理a0和b0
    {
        // 有a0，没b0
        ll ans1 = sub(power(2, a0_cnt), 1);
        // 没a0，有b0
        add_self(ans1, sub(power(2, b0_cnt), 1));
        // 都没有
        add_self(ans1, 1);
        mul_self(ans, ans1);
    }
    sub_self(ans, 1);  // 干掉一个都不选的
    add_self(ans, n0 - n);
    cout << ans << el;
}


Measured memory_bytes: 62112