#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std ;
template< class T > inl T read() {
	T x = 0 ; int f = 1 ; char k = getchar() ;
	for( ; k > '9' || k < '0'; k = getchar() ) if( k == '-' ) f = -1 ;
	for( ; k >= '0' && k <= '9'; k = getchar() ) x = x * 10 + k - '0' ;
	return x * f ;
}
template< class T > inl T read( T &x ) { return x = read<T>() ; }
int _num, _buf[20];
template< class T > il print( T x ) {
   	if( x == 0 ) return putchar( '0' ) ,void() ;
	if( x < 0 ) putchar( '-' ), x = -x ;
	while( x ) _buf[++_num] = x % 10, x /= 10 ;
	while( _num ) putchar( _buf[_num--] + '0' ) ;
}
ll mul( ll a, ll b, ll mod ) { long double c = 1. ; return ( a * b - (ll)( c * a * b / mod ) * mod ) % mod ; }
it qpow( int x, int m, int mod ) {
	int res = 1, bas = x ;
	while(m) {
		if( m & 1 ) res = ( 1ll * res * bas ) % mod ;
		bas = ( 1ll * bas * bas ) % mod, m >>= 1 ;
	}
	return res ;
}
const int N = 2e5 + 5, mod = 1e9 + 7 ;
it add( int x, int y ) {
	return x + y >= mod ? x + y - mod : x + y ;
}
it mul( int x, int y ) {
	return 1ll * x * y % mod ;
}
il inc( int &x, int y ) {
	x = add( x, y ) ;
}
int n, ans, num[2], f[N], pw[N];
ll A[N], B[N];
map< pair< ll, ll >, int > cnt;
int main() {
//	freopen( ".in", "r", stdin ) ;
//	freopen( ".out", "w", stdout ) ;
	n = read<int>(), pw[0] = 1 ;
	for( ri i = 1; i <= n; ++i ) {
		A[i] = read<ll>(), B[i] = read<ll>() ;
		pw[i] = mul( pw[i - 1], 2 ) ;
	}
	for( ri i = 1; i <= n; ++i ) {
		ans += A[i] == 0 && B[i] == 0 ;
		num[0] += A[i] == 0 && B[i] != 0 ;
		num[1] += A[i] != 0 && B[i] == 0 ;
	}
	int res = add( pw[num[0]], pw[num[1]] ) ;
	inc( res, mod - 1 ) ;
	for( ri i = 1; i <= n; ++i ) {
		ll d = __gcd( A[i], B[i] ) ;
		pair< ll, ll > tmp = { -B[i] / d, A[i] / d } ;
		if( tmp.second < 0 )
			tmp.first = -tmp.first, tmp.second = -tmp.second ;
		cnt[tmp] += 1 ;
	}
	for( ri i = 1; i <= n; ++i ) {
		ll d = __gcd( A[i], B[i] ) ;
		pair< ll, ll > tmp = { -B[i] / d, A[i] / d } ;
		if( tmp.second < 0 )
			tmp.first = -tmp.first, tmp.second = -tmp.second ;
		int x = cnt[tmp] ;
		cnt[tmp] = 0 ;
		tmp = { A[i] / d, B[i] / d } ;
		if( tmp.second < 0 )
			tmp.first = -tmp.first, tmp.second = -tmp.second ;
		int y = cnt[tmp] ;
		cnt[tmp] = 0 ;
		int upd = add( pw[x], pw[y] ) ;
		inc( upd, mod - 1 ) ;
		res = mul( res, upd ) ;
	}
	inc( ans, res ), inc( ans, mod - 1 ) ;
	print( ans ), puts( "" ) ;
	cerr << 1. * clock() / CLOCKS_PER_SEC << "\n" ;
	return 0;
}