//2020年4月17日現在

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include <cstdio>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }
template <class T, class... A>
void printd(const T &first, const A &... rest) { cout << fixed << setprecision(15) << first; prints_rest(rest...); }


namespace {
    // printElems(&a[0], &a[n]);　みたいな感じで使う。
    void printElems(const int* begin, const int* end)
    {
        for (const int* p = begin; p != end; ++p) {
            std::cout << *p << ' ';
        }
        std::cout << std::endl;
    }
}

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define FOR(i,j,n) for(int i=j; i < n; i++)
#define souatari(i,j,n) rep1(i,n-1)rep(j,i)
#define souatari1(i,j,n) for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
const ll BIG = 1LL<<60;

template <unsigned P>
struct ModInt
{
		using M = ModInt;
		unsigned v;
		ModInt() : v(0) {}
		ModInt(auto x) : v(x >= 0 ? x % P : (P - -x % P) % P) {}
		constexpr ModInt(unsigned v, int) : v(v) {}
		static constexpr unsigned p() { return P; }
		M operator+() const { return *this; }
		M operator-() const { return {v ? P - v : 0, 0}; }
		explicit operator bool() const noexcept { return v; }
		bool operator!() const noexcept { return !(bool)*this; }
		M operator*(M r) const { return M(*this) *= r; }
		M operator/(M r) const { return M(*this) /= r; }
		M operator+(M r) const { return M(*this) += r; }
		M operator-(M r) const { return M(*this) -= r; }
		bool operator==(M r) const { return v == r.v; }
		bool operator!=(M r) const { return !(*this == r); }
		M &operator*=(M r)
		{
				v = (uint64_t)v * r.v % P;
				return *this;
		}
		M &operator/=(M r) { return *this *= r.inv(); }
		M &operator+=(M r)
		{
				if ((v += r.v) >= P)
						v -= P;
				return *this;
		}
		M &operator-=(M r)
		{
				if ((v += P - r.v) >= P)
						v -= P;
				return *this;
		}
		M inv() const
		{
				int a = v, b = P, x = 1, u = 0;
				while (b)
				{
						int q = a / b;
						swap(a -= q * b, b);
						swap(x -= q * u, u);
				}
				assert(a == 1);
				return x;
		}
		M pow(auto n) const
		{
				if (n < 0)
						return pow(-n).inv();
				M res = 1;
				for (M a = *this; n; a *= a, n >>= 1)
						if (n & 1)
								res *= a;
				return res;
		}
		friend M operator*(auto l, M r) { return M(l) *= r; }
		friend M operator/(auto l, M r) { return M(l) /= r; }
		friend M operator+(auto l, M r) { return M(l) += r; }
		friend M operator-(auto l, M r) { return M(l) -= r; }
		friend ostream &operator<<(ostream &os, M r) { return os << r.v; }
		friend istream &operator>>(istream &is, M &r)
		{
				ll x;
				is >> x;
				r = x;
				return is;
		}
		friend bool operator==(auto l, M r) { return M(l) == r; }
		friend bool operator!=(auto l, M r) { return !(l == r); }
};

ll gcd(ll a,ll b){
	ll r = a%b;
	while (r != 0) {
		a = b;
		b = r;
		r = a%b;
	}
	return b;
}
ModInt<MOD> modpow(ll i, ll n){
	vector<ModInt<MOD>> tmparr;
	vector<bool> b;
	ModInt<MOD> tmp = i;
	ll ntmp = n;
	while(ntmp!=0){
		if (ntmp%2 == 1){b.push_back(true);}else{b.push_back(false);}
		ntmp/=2;
		tmparr.push_back(tmp);
		tmp*=tmp;
	}
	ModInt<MOD> ans = 1;
	rep(i,b.size()) if(b[i]) ans *= tmparr[i];
	return ans;
}

int main(){
	ll n;
	cin >> n;
	map<pll,int> m;
	rep(i,n){
		ll a,b;
		cin >> a >> b;
		ll gtmp = gcd(a,b);
		a /= gtmp;
		b /= gtmp;
		pll tmp = mp(a,b);
		if(m.find(tmp) == m.end()){
			m.insert(mp(tmp,1));
		}
		else{
			m[tmp]++;
		}
	}
	vector<pll> v;
	for(auto itr = m.begin(); itr != m.end(); ++itr){
		if(itr->second == 0) continue;
		pll tmp = itr->first;
		ll anstmp1 = itr->second;
		if(m.find(mp(-tmp.F,-tmp.S)) != m.end()) {anstmp1 += m[mp(-tmp.F,-tmp.S)]; m[mp(-tmp.F,-tmp.S)] = 0;}
		ll anstmp2 = 0;
		if(m.find(mp(tmp.S,-tmp.F)) != m.end()) {anstmp2 += m[mp(tmp.S,-tmp.F)]; m[mp(tmp.S,-tmp.F)] = 0;}
		if(m.find(mp(-tmp.S,tmp.F)) != m.end()) {anstmp2 += m[mp(-tmp.S,tmp.F)]; m[mp(-tmp.S,tmp.F)] = 0;}
		v.push_back(mp(anstmp1,anstmp2));
	}
	ModInt<MOD> ans = 1;
	for(const auto& x : v){
		ModInt<MOD> tmp1 = modpow(2,x.F);
		ModInt<MOD> tmp2 = 1;
		if(x.S!=0){tmp2 = modpow(2,x.S);}
		ans*=tmp1+tmp2-1;
	}
	ans-=1;
	prints(ans);



	return 0;
}

