#include<stdio.h>
#include<stdlib.h>
long gcd(long a,long b){return b?gcd(b,a%b):a;}
const long mod=1e9+7;
struct X{long A,B;int f;}A[2<<17];
long long O=mod-1;
int cmp(const void *a,const void *b){
    struct X *aa=(X *)a;
    struct X *bb=(X *)b;
    long dA=aa->A-bb->A,dB=aa->B-bb->B;
    return dA?dA<0?-1:1:dB?dB<0?-1:1:0;
};


int main()
{
    int N;long a,b;
    int sz=0;
    scanf("%d",&N);
    ////输入并实现a，b的标准化
    for(int i=0;i<N;i++){
        scanf("%ld %ld",&a,&b);
            int f=0;
        if(!a&&!b) O++;
        else{
              long g=gcd(a,b);
              a=a/g;b=b/g;
            if(a<0){
                a=-a;
                b=-b;
            }
            if(a==0){
                a=1;
                b=0;
                f=1;
            }
            else if(b<0){
                long t;
                t=a;
                a=-b;
                b=t;
                f=1;
            }
            A[sz].A=a;
            A[sz].B=b;
            A[sz].f=f;
            sz++;
        }
    }
    //实现排序
    qsort(A,sz,sizeof(struct X),cmp);
    //实现计算；
    long ans=1;
    for(int i=0;i<sz;){
        int c[2]={1,1};
        int j=i;
        while(i<sz&&A[i].A==A[j].A&&A[i].B==A[j].B){
            c[A[i].f]=c[A[i].f]*2%mod;
            i++;
        }
        ans=ans*(c[0]+c[1]-1)%mod;
    }
    printf("%d",(ans+O)%mod);
}