#include <numeric>
#include <iostream>
#include <array>
#include <string>
#include <vector>
#include <cassert>
#include <algorithm>
#include <math.h> 
#include <set>
#include <map>
#include <utility>
#include <deque>
#include <queue>
#include <iomanip>
#include <limits>

using namespace std;

#define ll long long int
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repp(i, n) for(ll i = 1; i <= n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define riverse(v) reverse((v).begin(), (v).end())
#define pb push_back
#define mp make_pair
#define all(a)  (a).begin(),(a).end()
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vb = vector<bool>;
using vvb = vector<vb>;
const ll MOD = 1e9 + 7;
const double pi = 3.14159265358979323846264338327950288;
vi alphabet = { 'a','b','c','d','e','f','g','h','i','j','k','l','m',
               'n','o','p','q','r','s','t','u','v','w','x','y','z' };

ll gcd(ll a, ll b) {
    if (a == 0 && b != 0) return(b);
    else if (a != 0 && b == 0) return(a);
    else if (a % b == 0)  return(b);
    else return(gcd(b, a % b));
}


int main() {
    int N;
    cin >> N;
    vll A(N);
    vll B(N);
    rep(i, N) {
        cin >> A[i];
        cin >> B[i];
    }
    int ex1=0;
    int ex2=0;
    int ex3=0;
    map<vll, int> gr;
    rep(i, N) {
        if (A[i] == 0 && B[i] == 0)ex1++;
        else if (A[i] == 0 && B[i] != 0)ex2++;
        else if (A[i] != 0 && B[i] == 0)ex3++;
        else {
            ll g = gcd(A[i], B[i]);
            A[i] /= g;
            B[i] /= g;
            vll v = { A[i],B[i] };
            vll u = { -B[i],A[i] };
            vll w = { B[i],-A[i] };
            if (gr.count(u) || gr.count[w]) {
                gr[u]++;
                gr[w]++;
            }
            else gr[v] = 1;
        }
    }
    ll ans = 0;
    ll k = ex2;
    for (pair<vll, int> p : gr) {
        ll v = p.second;
        k *= v + 1;
        k %= MOD;
    }
    ans += k;
    k = ex3;
    for (pair<vll, int> p : gr) {
        ll v = p.second;
        k *= v + 1;
        k %= MOD;
    }
    ans += k;
    k = 1;
    for (pair<vll, int> p : gr) {
        ll v = p.second;
        k *= v + 1;
        k %= MOD;
    }
    k -= 1;
    ans += k;
    if (ans < 0) ans += MOD;
    cout << ans << endl;
}   