#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 
#define MOD 1000000007
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
  scanf("%d",&head);
  RI(tail...);
}
using namespace std;
typedef long long LL;
using  P = pair<LL, LL>;

LL pw(LL x,LL y) {
	LL tmp = x;
	LL res = 1;
	while (y) {
		if (y%2) res = res*tmp%MOD;
		y >>= 1;
		tmp = tmp*tmp%MOD;
	}
	return res;
}

LL ans;
int n;
map<P,bool> vis;
map<P,int> mp;

int main()
{
	while (~scanf("%d", &n)) {
		mp.clear();
		vis.clear();

		REP(i,1,n) {
			LL a,b,g;
			scanf("%lld %lld", &a,&b);
			g = __gcd(abs(a), abs(b));
			a /= g;
			b /= g;

			if (a < 0) {
				a *= -1;
				b *= -1;
			}
			mp[make_pair(a,b)]++;

			vis[make_pair(a,b)] = true;
			if (b < 0) {
				vis[make_pair(-b,a)] = true;
			} else {
				vis[make_pair(b, -a)] = true;
			}
		}

		ans = 1;
		for (auto i: vis) if (i.first.first > 0 && i.first.second >= 0) {
			P tmp;
			tmp.first = i.first.second;
			tmp.second = i.first.first * -1;

			LL aa, bb;
			aa = mp[i.first];
			bb = mp[tmp];
			ans *= (pw(2, aa) + pw(2, bb) - 1 + MOD) % MOD;
			ans %= MOD;
		}

		printf("%lld\n", ans-1 + mp[make_pair(0LL, 0LL)]);
		
	}
  return 0;
}
