#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
template <class T>
bool chmax(T &a, const T &b)
{
	if (a < b)
	{
		a = b;
		return 1;
	}
	return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
	if (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
void solve()
{
	int n;
	cin>>n;
	int zz=0, a0=0,b0=0;
	set<pair<int,int>>ab,ba;
	map<pair<int,int>,int>abc,bac;
	rep(i,n){
		ll a,b;
		cin>>a>>b;
		if(a==0 && b==0){
			zz++;
		}else if(a==0){
			a0++;
		}else if(b==0){
			b0++;
		}else{
			ll c=gcd(a,b);
			a/=c;
			b/=c;
			ab.insert(make_pair(a,b));
			abc[make_pair(a,b)]++;
		}
	}
	ll m=0;
	m+=(ll)a0*b0;
	m+=(ll)zz*n;
	for(auto i=ab.begin(); i!=ab.end(); i++){
		pair<int,int>k=*i;
		m+=abc[*i]*(abc[make_pair(k.y,-k.x)]+abc[make_pair(-k.y,k.x)]);
	}
	m%=M;
	ll ans=modpow(2,n,M)-1;
	ans%=M;
	ans-=(modpow(2,n-2,M)-1)*m%M;
	while(ans<0){
		ans+=M;
	}
	cout<<ans<<endl;


}


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}
