#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
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 (b<a) { a=b; return 1; } return 0; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};


int main(){
	int n;
	cin >> n;
	int zero = 0;
	map<Pll, P> mp;
	for(int i = 0; i < n; i++) {
		ll x, y;
		cin >> x >> y;
		if (x == 0 && y == 0) {
			zero++;
			continue;
		}
		if (y < 0) {
			x = -x;
			y = -y;
		}
		if(y == 0 && x < 0) {
			x = -x;
		}
		g = gcd(x, y);
		x /= g;
		y /= g;
		bool rot = (x <= 0);
		if(rot) {
			swap(x, y);
			y = -y;
		}
		if(rot) {
			mp[{x, y}].second++;
		} else {
			mp[{x, y}].first++;
		}
	}

	mint ans = 1;
	for(auto& e: mp) {
		int s = e.second.first;
		int t = e.second.second;
		mint now = 1;
		now += mint(2).pow(s)-1;
		now += mint(2).pow(t)-1;
		ans *= now;
	}
	ans--;
	ans += zero;
	cout << ans << endl;
}