#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<cmath>
#include<algorithm>
#include<fstream>
#define MAXN 5000
using namespace std;
typedef long long int ll;
typedef __int64 i64;

int gcd(int a, int b)
{
  if (min(abs(a),abs(b)) == 0)return max(abs(a),abs(b));
  return gcd(abs(b),abs(a)%abs(b));
}

int main()
{
  //freopen("text.txt","r",stdin);
  //freopen("myresult.txt","w+",stdout);
  int n,m;
  int q[103],b[103];
  cin>>n>>m;
  for (int i(0); i<n+1; ++i)cin>>q[i];
  for (int j(0); j<m+1; ++j)cin>>b[j];
  if (n>m) {
    cout<<"Infinity"<<endl;
  } else {
    if (n == m) {
      int temp = gcd(q[0],b[0]);
      if (q[0]*b[0]<0)cout<<"-";
      cout<<abs(q[0])/temp<<"/"<<abs(b[0])/temp<<endl;
    } else {
      cout<<"0/1"<<endl;
    }
  }
  //system("pause");
  return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<cmath>
#include<algorithm>
#include<fstream>
#define MAXN 5000
using namespace std;
typedef long long int ll;
typedef __int64 i64;

int gcd(int a, int b)
{
  if (min(abs(a),abs(b)) == 0)return max(abs(a),abs(b));
  return gcd(abs(b),abs(a)%abs(b));
}

int main()
{
  //freopen("text.txt","r",stdin);
  //freopen("myresult.txt","w+",stdout);
  int n,m;
  int q[105],b[105];
  cin>>n>>m;
  for (int i(0); i<n+1; ++i)cin>>q[i];
  for (int j(0); j<m+1; ++j)cin>>b[j];
  if (n>m) {
    if (q[0]<0)cout<<'-';
    cout<<"Infinity"<<endl;
  } else {
    if (n == m) {
      int temp = gcd(q[0],b[0]);
      if (q[0]*b[0]<0)cout<<'-';
      cout<<abs(q[0])/temp<<'/'<<abs(b[0])/temp<<endl;
    } else {
      cout<<"0/1"<<endl;
    }
  }
  //system("pause");
  return 0;
}


#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<cmath>
#include<algorithm>
#include<fstream>
#define MAXN 5000
using namespace std;
typedef long long int ll;
typedef __int64 i64;

int gcd(int a, int b)
{
  if (min(abs(a),abs(b)) == 0)return max(abs(a),abs(b));
  return gcd(abs(b),abs(a)%abs(b));
}

int main()
{
  //freopen("text.txt","r",stdin);
  //freopen("myresult.txt","w+",stdout);
  int n,m;
  int q[105],b[105];
  cin>>n>>m;
  for (int i(0); i<n+1; ++i)cin>>q[i];
  for (int j(0); j<m+1; ++j)cin>>b[j];
  if (n>m) {
    if (q[0]<0)cout<<"-";
    cout<<"Infinity"<<endl;
  } else {
    if (n == m) {
      int temp = gcd(q[0],b[0]);
      if (q[0]*b[0]<0)cout<<"-";
      cout<<abs(q[0])/temp<<"/"<<abs(b[0])/temp<<endl;
    } else {
      cout<<"0/1"<<endl;
    }
  }
  //system("pause");
  return 0;
}


#include <cstdlib>
#include <iostream>
#include <stack>
#include <cstring>
#include <cmath>
#include <string>
#include <stdio.h>
#include <map>
#include <queue>
#include <list>
#include <vector>
#include <algorithm>

#define EPS 1e-8

const long MAX=1000;

typedef __int64 LONG;

using namespace std;

int gcd(int m,int n)
{
    if(n==0) return m;
    int r=m%n; m=n; n=r;
    return gcd(m,n);
}

int main(int argc, char *argv[])
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    vector <int> Vn,Vm;
    int n,m;
    cin>>n>>m;
    for(int i=0;i<=n;i++)
    {
        int t;
        cin>>t;
        Vn.push_back(t);
    }
    for(int i=0;i<=m;i++)
    {
        int t;
        cin>>t;
        Vm.push_back(t);
    }
    if(Vn.size()>Vm.size())
    {
        if((Vn[0]>0 && Vm[0]>0) || (Vn[0]<0 && Vm[0]<0)) cout<<"Infinity";
        else cout<<"-Infinity";
    }
    else if(Vn.size()<Vm.size()) cout<<"0/1";
    else
    {
        int g=abs(gcd(Vn[0],Vm[0]));
        double zn=(double)(Vn[0]/Vm[0]);
        if(zn<0) cout<<"-";
        cout<<abs(Vn[0]/g)<<"/"<<abs(Vm[0]/g);
    }
    return EXIT_SUCCESS;
}


#include <cstdlib>
#include <iostream>
#include <stack>
#include <cstring>
#include <cmath>
#include <string>
#include <stdio.h>
#include <map>
#include <queue>
#include <list>
#include <vector>
#include <algorithm>

#define EPS 1e-8

const long MAX=1000;

typedef __int64 LONG;

using namespace std;

int gcd(int m,int n)
{
    if(n==0) return m;
    int r=m%n; m=n; n=r;
    return gcd(m,n);
}

int main(int argc, char *argv[])
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    vector <int> Vn,Vm;
    int n,m;
    cin>>n>>m;
    for(int i=0;i<=n;i++)
    {
        int t;
        cin>>t;
        Vn.push_back(t);
    }
    for(int i=0;i<=m;i++)
    {
        int t;
        cin>>t;
        Vm.push_back(t);
    }
    if(Vn.size()>Vm.size())
    {
        if((Vn[0]>0 && Vm[0]>0) || (Vn[0]<0 && Vm[0]<0)) cout<<"Infinity";
        else cout<<"-Infinity";
    }
    else if(Vn.size()<Vm.size()) cout<<"0/1";
    else
    {
        int g=abs(gcd(Vn[0],Vm[0]));
        double zn=Vn[0]/Vm[0];
        if(zn<0) cout<<"-";
        cout<<abs(Vn[0]/g)<<"/"<<abs(Vm[0]/g);
    }
    return EXIT_SUCCESS;
}


#include <cstdlib>
#include <iostream>
#include <stack>
#include <cstring>
#include <cmath>
#include <string>
#include <stdio.h>
#include <map>
#include <queue>
#include <list>
#include <vector>
#include <algorithm>

#define EPS 1e-8

const long MAX=1000;

typedef __int64 LONG;

using namespace std;

int gcd(int m,int n)
{
    if(n==0) return m;
    int r=m%n; m=n; n=r;
    return gcd(m,n);
}

int main(int argc, char *argv[])
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    vector <int> Vn,Vm;
    int n,m;
    cin>>n>>m;
    for(int i=0;i<=n;i++)
    {
        int t;
        cin>>t;
        Vn.push_back(t);
    }
    for(int i=0;i<=m;i++)
    {
        int t;
        cin>>t;
        Vm.push_back(t);
    }
    if(Vn.size()>Vm.size())
    {
        if((Vn[0]>0 && Vm[0]>0) || (Vn[0]<0 && Vm[0]<0)) cout<<"Infinity";
        else cout<<"-Infinity";
    }
    else if(Vn.size()<Vm.size()) cout<<"0/1";
    else
    {
        int g=abs(gcd(Vn[0],Vm[0]));
        double zn=(double)Vn[0]/Vm[0];
        if(zn<0) cout<<"-";
        cout<<abs(Vn[0]/g)<<"/"<<abs(Vm[0]/g);
    }
    return EXIT_SUCCESS;
}


#include <cstdlib>
#include <iostream>
#include <stack>
#include <cstring>
#include <cmath>
#include <string>
#include <stdio.h>
#include <map>
#include <queue>
#include <list>
#include <vector>
#include <algorithm>

#define EPS 1e-8

const long MAX=1000;

typedef __int64 LONG;

using namespace std;

int gcd(int m,int n)
{
    if(n==0) return m;
    int r=m%n; m=n; n=r;
    return gcd(m,n);
}

int main(int argc, char *argv[])
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    vector <int> Vn,Vm;
    int n,m;
    cin>>n>>m;
    for(int i=0;i<=n;i++)
    {
        int t;
        cin>>t;
        Vn.push_back(t);
    }
    for(int i=0;i<=m;i++)
    {
        int t;
        cin>>t;
        Vm.push_back(t);
    }
    if(Vn.size()>Vm.size())
    {
        if(Vn[0]>0) cout<<"Infinity";
        else cout<<"-Infinity";
    }
    else if(Vn.size()<Vm.size()) cout<<"0/1";
    else
    {
        int g=gcd(Vn[0],Vm[0]);
        double zn=Vn[0]/Vm[0];
        if(zn<0) cout<<"-";
        cout<<abs(Vn[0]/g)<<"/"<<abs(Vm[0]/g);
    }
    return EXIT_SUCCESS;
}


#include <cstdlib>
#include <iostream>
#include <stack>
#include <cstring>
#include <cmath>
#include <string>
#include <stdio.h>
#include <map>
#include <queue>
#include <list>
#include <vector>
#include <algorithm>

#define EPS 1e-8

const long MAX=1000;

typedef __int64 LONG;

using namespace std;

int gcd(int m,int n)
{
    if(n==0) return m;
    int r=m%n; m=n; n=r;
    return gcd(m,n);
}

int main(int argc, char *argv[])
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    vector <int> Vn,Vm;
    int n,m;
    cin>>n>>m;
    for(int i=0;i<=n;i++)
    {
        int t;
        cin>>t;
        Vn.push_back(t);
    }
    for(int i=0;i<=m;i++)
    {
        int t;
        cin>>t;
        Vm.push_back(t);
    }
    if(Vn.size()>Vm.size())
    {
        if((Vn[0]>0 && Vm[0]>0) || (Vn[0]<0 && Vm[0]<0)) cout<<"Infinity";
        else cout<<"-Infinity";
    }
    else if(Vn.size()<Vm.size()) cout<<"0/1";
    else
    {
        int g=gcd(Vn[0],Vm[0]);
        double zn=Vn[0]/Vm[0];
        if(zn<0) cout<<"-";
        cout<<abs(Vn[0]/g)<<"/"<<abs(Vm[0]/g);
    }
    return EXIT_SUCCESS;
}


#include <cstdlib>
#include <iostream>
#include <stack>
#include <cstring>
#include <cmath>
#include <string>
#include <stdio.h>
#include <map>
#include <queue>
#include <list>
#include <vector>
#include <algorithm>

#define EPS 1e-8

const long MAX=1000;

typedef __int64 LONG;

using namespace std;

int gcd(int m,int n)
{
    if(n==0) return m;
    int r=m%n; m=n; n=r;
    return gcd(m,n);
}

int main(int argc, char *argv[])
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    vector <int> Vn,Vm;
    int n,m;
    cin>>n>>m;
    for(int i=0;i<=n;i++)
    {
        int t;
        cin>>t;
        Vn.push_back(t);
    }
    for(int i=0;i<=m;i++)
    {
        int t;
        cin>>t;
        Vm.push_back(t);
    }
    if(Vn.size()>Vm.size())
    {
        if(Vn[0]>0) cout<<"Infinity";
        else cout<<"-Infinity";
    }
    else if(Vn.size()<Vm.size()) cout<<"0/1";
    else
    {
        int g=gcd(Vn[0],Vm[0]);
        double zn=Vn[0]/Vm[0];
        if(zn<0) cout<<"-";
        cout<<Vn[0]/g<<"/"<<Vm[0]/g;
    }
    return EXIT_SUCCESS;
}


#include <iostream>
using namespace std;
int gcd(int a, int b){
return b?gcd(b,a%b):a;}
int main()
{
int i,n,m,x,y,g;
cin>>n>>m>>x; for (i=-1;i<n;i++) {cin>>y;}
g=gcd(x,y);
x/=g;y/=g;
if (n>m) x*y>0?cout<<"Infinity" : cout<<"-Infinity";
else if (n==m) {if(x*y<0)cout<<"-"; if(x<0)x=-x;if(y<0)y=-y; cout<<x<<"/"<<y;}
else cout<<"0/1";
return 0;
}


#include <iostream>
using namespace std;
int gcd(int a, int b){
return b?gcd(b,a%b):a;}
int main()
{
int i,n,m,x,y,g;
cin>>n>>m>>x; for (i=-1;i<n;i++) {cin>>y;}
g=gcd(x,y);
if (n>m) x*y>0?cout<<"Infinity" : cout<<"-Infinity";
else if (n==m) x*y>0?cout<<x/g<<"/"<<y/g : cout<<"-"<<x/g<<"/"<<-y/g;
else cout<<"0/1";
return 0;
}


#include <iostream>
using namespace std;
int gcd(int a, int b){
return b?gcd(b,a%b):a;}
int main()
{
int i,n,m,x,y,g;
cin>>n>>m>>x; for (i=-1;i<n;i++) {cin>>y;}
g=gcd(x,y);
if (n>m) x>0?cout<<"Infinity" : cout<<"-Infinity";
else if (n==m) x&&y?cout<<x/g<<"/"<<y/g : cout<<"-"<<x<<"/"<<y;
else cout<<"0/1";
return 0;
}


#include <iostream>
using namespace std;
int gcd(int a, int b){
return b?gcd(b,a%b):a;}
int main()
{
int i,n,m,x,y,g;
cin>>n>>m>>x; for (i=-1;i<n;i++) {cin>>y;}
g=gcd(x,y);
x/=g;y/=g;
if(x<0)x=-x;if(y<0)y=-y;
if (n>m) {if (x<0)cout<<"-"; cout<<"Infinity";}
else if (n==m) {if (x*y<0)cout<<"-"; cout<<x<<"/"<<y;}
else cout<<"0/1";
return 0;
}


#include <iostream>
using namespace std;
int gcd(int a, int b){
return b?gcd(b,a%b):a;}
int main()
{
int i,n,m,x,y,g;
cin>>n>>m>>x; for (i=-1;i<n;i++) {cin>>y;}
g=gcd(x,y);
if (n>m) x*y>0?cout<<"Infinity" : cout<<"-Infinity";
else if (n==m) x*y>0?cout<<x/g<<"/"<<y/g : cout<<x/g<<"/"<<y/g;
else cout<<"0/1";
return 0;
}


#include <iostream>
using namespace std;
int gcd(int a, int b){
return b?gcd(b,a%b):a;}
int main()
{
int i,n,m,x,y,g;
cin>>n>>m>>x; for (i=-1;i<n;i++) {cin>>y;}
g=gcd(x,y); if (x*y<0&&g>0)g=-g;cout<<g<<" "<<x/g<<" "<<y/g<<"\n";
if (n>m) x*y>0?cout<<"Infinity" : cout<<"-Infinity";
else if (n==m) x*y>0?cout<<x/g<<"/"<<y/g : cout<<x/g<<"/"<<y/g;
else cout<<"0/1";
return 0;
}


#include <iostream>
using namespace std;
int gcd(int a, int b){
return b?gcd(b,a%b):a;}
int main()
{
int i,n,m,x,y,g;
cin>>n>>m>>x; for (i=-1;i<n;i++) {cin>>y;}
g=gcd(x,y);
x/=g;y/=g;
if(x<0)x=-x;if(y<0)y=-y;
if (n>m) {if (x*y<0)cout<<"-"; cout<<"Infinity";}
else if (n==m) {if (x*y<0)cout<<"-"; cout<<x<<"/"<<y;}
else cout<<"0/1";
return 0;
}


#include <iostream>
using namespace std;
int gcd(int a, int b){
return b?gcd(b,a%b):a;}
int main()
{
int i,n,m,x,y,g;
cin>>n>>m>>x; for (i=-1;i<n;i++) {cin>>y;}
g=gcd(x,y); if (x*y<0&&g>0)g=-g;
if (n>m) x*y>0?cout<<"Infinity" : cout<<"-Infinity";
else if (n==m) x*y>0?cout<<x/g<<"/"<<y/g : cout<<x/g<<"/"<<y/g;
else cout<<"0/1";
return 0;
}


#include <iostream>
using namespace std;
int gcd(int a, int b){
return b?gcd(b,a%b):a;}
int main()
{
int i,n,m,x,y,g;
cin>>n>>m>>x; for (i=-1;i<n;i++) {cin>>y;}
g=gcd(x,y);
x/=g;y/=g;
if (x*y<0)cout<<"-";
if(x<0)x=-x;if(y<0)y=-y;
if (n>m) cout<<"Infinity";
else if (n==m) cout<<x<<"/"<<y;
else cout<<"0/1";
return 0;
}


#include <iostream>
using namespace std;
int gcd(int a, int b){
return b?gcd(b,a%b):a;}
int main()
{
int i,n,m,x,y,g;
cin>>n>>m>>x; for (i=-1;i<n;i++) {cin>>y;}
g=gcd(x,y);
if (n>m) x*y>0?cout<<"Infinity" : cout<<"-Infinity";
else if (n==m) x&&y?cout<<x/g<<"/"<<y/g : cout<<"-"<<x<<"/"<<y;
else cout<<"0/1";
return 0;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
#define ll int
#include<queue>
#include<math.h>

int main()
{
    int n,m,x=1,y=1,i,f,a[105],b[105];
    scanf("%d%d",&n,&m);
    for(i=0;i<=n;i++)
        scanf("%d",&a[i]);
    for(i=0;i<=m;i++)
        scanf("%d",&b[i]);
    if(a[0]<0) x=0;
    if(b[0]<0) y=0;
    f=x+y;
    if(n>m)
    {

        if(f!=1) puts("Infinity");
        else puts("-Infinity");
    }
    else if(n<m)
    {
        puts("0/1");
    }
    else
    {
        int gcd;
        if(f==1)
        {
            if(x==0) a[0]=-a[0];
            if(y==0) b[0]=-b[0];
            putchar('-');
        }
        else if(!f)
        {
            a[0]=-a[0];
            b[0]=-b[0];
        }
        gcd=__gcd(a[0],b[0]);
        printf("%d/%d\n",a[0]/gcd,b[0]/gcd);
    }
    return 0;
}/*2018-07-31 14:22:53.411*/


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MAX = 123;
int a[MAX], b[MAX];

int gcd(int x, int y) {
    if(y == 0)
        return x;
    return gcd(y, x % y);
}

int main() {
    int n, m;
    cin >> n >> m;
    for(int i = 0; i <= n; i++)
        cin >> a[i];
    for(int i = 0; i <= m; i++)
        cin >> b[i];
    if(n == m) {
        if(a[0] * b[0] < 0) {
            printf("-");
            a[0] = abs(a[0]);
            b[0] = abs(b[0]);
        }
        int g = gcd(a[0], b[0]);
        printf("%d/%d", a[0] / g, b[0] / g);
    } else if(n > m) {
        if(a[0] * b[0] > 0)
            printf("Infinity");
        else
            printf("-Infinity");
    } else {
        printf("0/1");
    }
    puts("");
    return 0;
}
/*2018-07-28 19:32:09.684*/


//#pragma GCC optimize(2)
//#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>

using namespace std;
typedef long long LL;
const int INF = 0x3F3F3F3F;
const int INTMAX = 0x7FFFFFFF;
const LL LLINF = 0x3F3F3F3F3F3F3F3F;
const double PI = acos(-1);
const int MAXN = 1005 + 10;
const int MAXM = 1e6 + 10;
const LL MOD = 1e9 + 7;

int n, m, a[MAXN], b[MAXN];

int main() {

    while(cin >> n >> m) {
        for(int i = 0; i <= n; i++ ) {
            cin >> a[i];
        }
        for(int i = 0; i <= m; i++ ) {
            cin >> b[i];
        }
        if(n > m) {
            if(a[0] * b[0] < 0) {
                cout << "-Infinity" << endl;
            } else {
                cout << "Infinity" << endl;
            }
        } else if(n < m) {
            cout << "0/1" << endl;
        } else if(n == m) {
            int gcd = __gcd(a[0], b[0]);
            cout << a[0] / gcd<< "/" << b[0] / gcd << endl;
        }
    }

    return 0;
}/*2018-07-28 23:07:17.079*/


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int matha[105];
int mathb[105];
int myabs(int ans)
{
    if(ans<0)
        return -ans;
    return ans;
}
int main()
{
    int n,m;
    while(~scanf("%d%d",&n,&m))
    {
        for(int i=0; i<n+1; i++)
            scanf("%d",&matha[i]);
        for(int i=0; i<m+1; i++)
            scanf("%d",&mathb[i]);
        if(n==m)
        {
            if(matha[0]==0)
                printf("0/1\n");
            else if(mathb[0]==0)
            {
                printf("Infinity\n");
            }
            else
            {
                int ans=__gcd(myabs(matha[0]),myabs(mathb[0]));
                if(matha[0]*mathb[0]<0)
                    printf("-%d/%d\n",myabs(matha[0]/ans),myabs(mathb[0]/ans));
                else
                    printf("%d/%d\n",myabs(matha[0]/ans),myabs(mathb[0]/ans));
            }
        }
        else if(n>m)
        {
            if(matha[0]>0&&mathb[0]>0)
                printf("Infinity\n");
            else if(matha[0]>0&&mathb[0]<0)
                printf("-Infinity\n");
            else if(matha[0]<0&&mathb[0]>0)
                printf("-Infinity\n");
            else
                printf("Infinity\n");
        }
        else
        {
            printf("0/1\n");
        }
    }
    return 0;
}/*2018-07-28 20:57:28.574*/


#include<stdio.h>
#include<algorithm>
#include<string>
#include<iostream>
#include<vector>
#include<string.h>
using namespace std;
int a[105],b[105];
int main()
{
    int n,m,check=0,ans1=0,ans2=0,re=0;
    scanf("%d %d",&n,&m);
    for(int i=0; i<=n; i++)
    {
        scanf("%d",&a[i]);
    }
    for(int i=0; i<=m; i++)
    {
        scanf("%d",&b[i]);
    }
    if(n>m)
    {
        if(a[0]>0&&b[0]>0)
            puts("Infinity");
        else if(a[0]<0&&b[0]<0)
            puts("Infinity");
        else
            puts("-Infinity");
    }
    if(n==m)
    {
        ans1=a[0];
        ans2=b[0];
        re=__gcd(a[0],b[0]);
        printf("%d/%d\n",ans1/re,ans2/re);
    }
    if(n<m)
        puts("0/1");
}

/*2018-07-28 20:43:49.902*/


#include<stdio.h>
#include<stdlib.h>
int a[121];
int b[121];
int gcd(int a,int b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    for(int i = 0;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(int i = 0;i<=m;i++)
    {
        scanf("%d",&b[i]);
    }
    if(n>m)
    {
        if(a[0]*b[0] > 0)
        printf("Infinity\n");
        else
        printf("-Infinity\n");
    }
    else if(n<m)
    {
        if(a[0]*b[0]>0)
            printf("0/1\n");
        else
            printf("-0/1\n");
    }
    else if(n==m)
    {
        int  d = gcd(a[0],b[0]);
        d = abs(d);
        int flag = a[0]*b[0];
        if(flag > 0)
        {
            flag = 1;
        }
        else
            flag = -1;
        a[0] = abs(a[0]);
        b[0] = abs(b[0]);
        if(flag >0)
        {
            printf("%d/%d\n",a[0]/d,b[0]/d);
        }
        else
            printf("-%d/%d\n",a[0]/d,b[0]/d);
    }
}
/*2018-07-28 20:32:19.213*/


#include<stdio.h>
#include<string.h>
int a[105],b[105];
int f(int a,int b)
{
    if(a%b==0)return b;
    else return f(b,a%b);
}
int main()
{
    int n,m;
    while(~scanf("%d%d",&n,&m))
    {
        for(int i=0; i<=n; i++)
            scanf("%d",&a[i]);
        for(int i=0; i<=m; i++)
            scanf("%d",&b[i]);
        if(n>m)
        {
            if(a[0]>0&&b[0]>0)
                puts("Infinity");
            else if(a[0]<0&&b[0]<0)
                puts("Infinity");
            else
                puts("-Infinity");
            continue;
        }
        if(n<m)
        {
            puts("0/1");
            continue;
        }
        if(n==m)
        {
            int x=a[0];
            int y=b[0];
            int z=f(a[0],b[0]);
            if(y<0)
            {
                y=-y;
                x=-x;
            }
            if(z<0)
                z=-z;
            printf("%d/%d\n",x/z,y/z);
        }
    }
}
/*2018-07-28 19:34:06.57*/


#include<bits/stdc++.h>
#define endl            '\n'
#define nl              printf("\n");
#define sz(x)           (int)((x).size())
#define len(x)          (x).length()
#define all(a)          (a).begin(),(a).end()
#define rep(i,n)        for( int i=0; i<(int)(n);i++ )
#define brep(i,n)       for( int i=(int)(n);i>=0;i-- )
#define repp(i,a,b)     for( int i = (a); i < (b); i++ )
#define brepp(i,a,b)    for( int i = (a); i >= (b); i-- )
#define swap(a,b)       (a)^=(b); (b)^=(a); (a)^=(b);
#define exp(a,b)        ceil( pow(a,b))
#define pi(x)           printf("%I64d",(x))
#define si(x)           scanf("%I64d",&(x))
#define si2(x,y)        scanf("%I64d %I64d",&(x),&(y))
#define si3(x,y,z)      scanf("%I64d %I64d %I64d",&(x),&(y),&(z))

#define pb      push_back
#define mp      make_pair
#define ll      long long int
#define ull     unsigned long long int
#define vi      vector<int>
#define vll     vector<ll>
#define vull    vector<ull>
#define vvi     vector<vector<int> >
#define pii     pair<int,int>
#define vpii    vector<pair<int,int> >

#define test int t; cin >> t; while( t-- > 0 )
#define mod 1000000007

using namespace std;

void simple(int n,int d)
        {
            int s,f;
            s=n;
            if(d <s)
            s=d;
            for(int i=2;i<=s;i++)
            {
            do{
                if((n%i==0) && (d%i==0))
                {

                        n=n/i;
                        d=d/i;
                        f=1;
                }
                else
                f=0;
              }while(f==1);
            }
            if(n*d<0)cout<<"-";
            n=(int)abs(n);
            d=(int)abs(d);
            cout<<n<<"/"<<d<<endl;
        }

int main()
{
    ios_base::sync_with_stdio(false);   cin.tie(0);
    int n,m,a[101],b[101];
    cin>>n>>m;
    for(int i=0;i<n+1;i++)
        cin>>a[i];
    for(int i=0;i<m+1;i++)
        cin>>b[i];
if(n>m)
        {
            (a[0]*b[0]<0)?cout<<"-Infinity":cout<<"Infinity";
            return 0;
        }
if(n<m)
        {
            cout<<"0/1";    return 0;
        }
    simple(a[0],b[0]);
    //if(__gcd(a[0],b[0])==1)cout<<a[0]<<"/"<<b[0];
    //else {
//  int temp=__gcd(a[0],b[0]);
//  if(temp)co
return 0;
}


#include<bits/stdc++.h>
#define endl 			'\n'
#define nl 				printf("\n");
#define sz(x) 			(int)((x).size())
#define len(x)			(x).length()
#define all(a) 			(a).begin(),(a).end()
#define rep(i,n) 		for( int i=0; i<(int)(n);i++ )
#define brep(i,n) 		for( int i=(int)(n);i>=0;i-- )
#define repp(i,a,b) 	for( int i = (a); i < (b); i++ )
#define brepp(i,a,b) 	for( int i = (a); i >= (b); i-- )
#define swap(a,b) 		(a)^=(b); (b)^=(a); (a)^=(b);
#define exp(a,b)        ceil( pow(a,b))
#define pi(x)			printf("%I64d",(x))
#define si(x)			scanf("%I64d",&(x))
#define si2(x,y)		scanf("%I64d %I64d",&(x),&(y))
#define si3(x,y,z)		scanf("%I64d %I64d %I64d",&(x),&(y),&(z))

#define pb 		push_back
#define mp		make_pair
#define ll	    long long int
#define ull	    unsigned long long int
#define vi 		vector<int>
#define vll		vector<ll>
#define vull	vector<ull>
#define vvi		vector<vector<int> >
#define pii		pair<int,int>
#define vpii	vector<pair<int,int> >

#define test int t; cin >> t; while( t-- > 0 )
#define mod 1000000007

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);	cin.tie(0);
	ull l,b,r,d;
	cin>>l>>b>>r;
	d=r*2;
	ull cir=d*d,ar=d*b;
	ar=ar/cir;
	ull x=l,plates=0;
	while(x>=d)
	{
		plates+=ar;
		x-=d;
	}
	(plates%2)?cout<<"First":cout<<"Second";

	return 0;
}


#include<bits/stdc++.h>
#define endl            '\n'
#define nl              printf("\n");
#define sz(x)           (int)((x).size())
#define len(x)          (x).length()
#define all(a)          (a).begin(),(a).end()
#define rep(i,n)        for( int i=0; i<(int)(n);i++ )
#define brep(i,n)       for( int i=(int)(n);i>=0;i-- )
#define repp(i,a,b)     for( int i = (a); i < (b); i++ )
#define brepp(i,a,b)    for( int i = (a); i >= (b); i-- )
#define swap(a,b)       (a)^=(b); (b)^=(a); (a)^=(b);
#define exp(a,b)        ceil( pow(a,b))
#define pi(x)           printf("%I64d",(x))
#define si(x)           scanf("%I64d",&(x))
#define si2(x,y)        scanf("%I64d %I64d",&(x),&(y))
#define si3(x,y,z)      scanf("%I64d %I64d %I64d",&(x),&(y),&(z))

#define pb      push_back
#define mp      make_pair
#define ll      long long int
#define ull     unsigned long long int
#define vi      vector<int>
#define vll     vector<ll>
#define vull    vector<ull>
#define vvi     vector<vector<int> >
#define pii     pair<int,int>
#define vpii    vector<pair<int,int> >

#define test int t; cin >> t; while( t-- > 0 )
#define mod 1000000007

using namespace std;

void simple(int n,int d)
        {
            int s,f;
            s=n;
            if(d <s)
            s=d;
            for(int i=2;i<=s;i++)
            {
            do{
                if((n%i==0) && (d%i==0))
                {

                        n=n/i;
                        d=d/i;
                        f=1;
                }
                else
                f=0;
              }while(f==1);
            }
            if(n*d<0)cout<<"-";
            n=abs(n);
            d=abs(d);
            cout<<n<<"/"<<d<<endl;
        }

int main()
{
    ios_base::sync_with_stdio(false);   cin.tie(0);
    int n,m,a[101],b[101];
    cin>>n>>m;
    for(int i=0;i<n+1;i++)
        cin>>a[i];
    for(int i=0;i<m+1;i++)
        cin>>b[i];
if(n>m)
        {
            if(a[0]*b[0]<0)cout<<"-";
            cout<<"Infinity";
            return 0;
        }
if(n<m)
        {
            cout<<"0/1";    return 0;
        }
//  simple(a[0],b[0]);
    if(__gcd(a[0],b[0])==1)
    {
    if(a[0]*b[0]<0)cout<<"-";
    cout<<abs(a[0])<<"/"<<abs(b[0]);
        }else
         {
    int temp=__gcd(a[0],b[0]);
    if(a[0]*b[0]<0)cout<<"-";
    cout<<abs(a[0]/temp)<<"/"<<abs(b[0]/temp);
        }
return 0;
}


#include<bits/stdc++.h>
#define endl            '\n'
#define nl              printf("\n");
#define sz(x)           (int)((x).size())
#define len(x)          (x).length()
#define all(a)          (a).begin(),(a).end()
#define rep(i,n)        for( int i=0; i<(int)(n);i++ )
#define brep(i,n)       for( int i=(int)(n);i>=0;i-- )
#define repp(i,a,b)     for( int i = (a); i < (b); i++ )
#define brepp(i,a,b)    for( int i = (a); i >= (b); i-- )
#define swap(a,b)       (a)^=(b); (b)^=(a); (a)^=(b);
#define exp(a,b)        ceil( pow(a,b))
#define pi(x)           printf("%I64d",(x))
#define si(x)           scanf("%I64d",&(x))
#define si2(x,y)        scanf("%I64d %I64d",&(x),&(y))
#define si3(x,y,z)      scanf("%I64d %I64d %I64d",&(x),&(y),&(z))

#define pb      push_back
#define mp      make_pair
#define ll      long long int
#define ull     unsigned long long int
#define vi      vector<int>
#define vll     vector<ll>
#define vull    vector<ull>
#define vvi     vector<vector<int> >
#define pii     pair<int,int>
#define vpii    vector<pair<int,int> >

#define test int t; cin >> t; while( t-- > 0 )
#define mod 1000000007

using namespace std;

void simple(int n,int d)
        {
            int s,f;
            s=n;
            if(d <s)
            s=d;
            for(int i=2;i<=s;i++)
            {
            do{
                if((n%i==0) && (d%i==0))
                {

                        n=n/i;
                        d=d/i;
                        f=1;
                }
                else
                f=0;
              }while(f==1);
            }
            if(n*d<0)cout<<"-";
            n=abs(n);
            d=abs(d);
            cout<<n<<"/"<<d<<endl;
        }

int main()
{
    ios_base::sync_with_stdio(false);   cin.tie(0);
    int n,m,a[101],b[101];
    cin>>n>>m;
    for(int i=0;i<n+1;i++)
        cin>>a[i];
    for(int i=0;i<m+1;i++)
        cin>>b[i];
if(n>m)
        {
            if(a[0]*b[0]<0)cout<<"-";
            cout<<"Infinity";
            return 0;
        }
if(n<m)
        {
            cout<<"0/1";    return 0;
        }
//  simple(a[0],b[0]);
    if(__gcd(a[0],b[0])==1)
    {
        cout<<a[0]<<"/"<<b[0];
        }else
         {
    int temp=__gcd(a[0],b[0]);
    if(a[0]*b[0]<0)cout<<"-";
    temp=abs(temp);
    cout<<abs(a[0])/temp<<"/"<<abs(b[0])/temp;
        }
return 0;
}


#include<bits/stdc++.h>
#define endl 			'\n'
#define nl 				printf("\n");
#define sz(x) 			(int)((x).size())
#define len(x)			(x).length()
#define all(a) 			(a).begin(),(a).end()
#define rep(i,n) 		for( int i=0; i<(int)(n);i++ )
#define brep(i,n) 		for( int i=(int)(n);i>=0;i-- )
#define repp(i,a,b) 	for( int i = (a); i < (b); i++ )
#define brepp(i,a,b) 	for( int i = (a); i >= (b); i-- )
#define swap(a,b) 		(a)^=(b); (b)^=(a); (a)^=(b);
#define exp(a,b)        ceil( pow(a,b))
#define pi(x)			printf("%I64d",(x))
#define si(x)			scanf("%I64d",&(x))
#define si2(x,y)		scanf("%I64d %I64d",&(x),&(y))
#define si3(x,y,z)		scanf("%I64d %I64d %I64d",&(x),&(y),&(z))

#define pb 		push_back
#define mp		make_pair
#define ll	    long long int
#define ull	    unsigned long long int
#define vi 		vector<int>
#define vll		vector<ll>
#define vull	vector<ull>
#define vvi		vector<vector<int> >
#define pii		pair<int,int>
#define vpii	vector<pair<int,int> >

#define test int t; cin >> t; while( t-- > 0 )
#define mod 1000000007

using namespace std;

void simple(int n,int d)
		{
			int s,f;
			s=n;
			if(d <s)
			s=d;
			for(int i=2;i<=s;i++)
			{
			do{
				if((n%i==0) && (d%i==0))
				{

						n=n/i;
						d=d/i;
						f=1;
			    }
			    else
			    f=0;
			  }while(f==1);
			}
			if(n*d<0)cout<<"-";
			n=abs(n);
			d=abs(d);
			cout<<n<<"/"<<d<<endl;
		}

int main()
{
	ios_base::sync_with_stdio(false);	cin.tie(0);
	int n,m,a[101],b[101];
	cin>>n>>m;
	for(int i=0;i<n+1;i++)
		cin>>a[i];
	for(int i=0;i<m+1;i++)
		cin>>b[i];
if(n>m)
		{
			(a[0]*b[0]<0)?cout<<"-Infinity":cout<<"Infinity";
			return 0;
		}
if(n<m)
		{
			cout<<"0/1";	return 0;
		}
	simple(a[0],b[0]);
	//if(__gcd(a[0],b[0])==1)cout<<a[0]<<"/"<<b[0];
	//else {
//	int temp=__gcd(a[0],b[0]);
//	if(temp)co
return 0;
}


#include<bits/stdc++.h>
#define endl            '\n'
#define nl              printf("\n");
#define sz(x)           (int)((x).size())
#define len(x)          (x).length()
#define all(a)          (a).begin(),(a).end()
#define rep(i,n)        for( int i=0; i<(int)(n);i++ )
#define brep(i,n)       for( int i=(int)(n);i>=0;i-- )
#define repp(i,a,b)     for( int i = (a); i < (b); i++ )
#define brepp(i,a,b)    for( int i = (a); i >= (b); i-- )
#define swap(a,b)       (a)^=(b); (b)^=(a); (a)^=(b);
#define exp(a,b)        ceil( pow(a,b))
#define pi(x)           printf("%I64d",(x))
#define si(x)           scanf("%I64d",&(x))
#define si2(x,y)        scanf("%I64d %I64d",&(x),&(y))
#define si3(x,y,z)      scanf("%I64d %I64d %I64d",&(x),&(y),&(z))

#define pb      push_back
#define mp      make_pair
#define ll      long long int
#define ull     unsigned long long int
#define vi      vector<int>
#define vll     vector<ll>
#define vull    vector<ull>
#define vvi     vector<vector<int> >
#define pii     pair<int,int>
#define vpii    vector<pair<int,int> >

#define test int t; cin >> t; while( t-- > 0 )
#define mod 1000000007

using namespace std;

void simple(int n,int d)
        {
            int s,f;
            s=n;
            if(d <s)
            s=d;
            for(int i=2;i<=s;i++)
            {
            do{
                if((n%i==0) && (d%i==0))
                {

                        n=n/i;
                        d=d/i;
                        f=1;
                }
                else
                f=0;
              }while(f==1);
            }
            if(n*d<0)cout<<"-";
            n=abs(n);
            d=abs(d);
            cout<<n<<"/"<<d<<endl;
        }

int main()
{
    ios_base::sync_with_stdio(false);   cin.tie(0);
    int n,m,a[101],b[101];
    cin>>n>>m;
    for(int i=0;i<n+1;i++)
        cin>>a[i];
    for(int i=0;i<m+1;i++)
        cin>>b[i];
if(n>m)
        {
            if(a[0]*b[0]<0)cout<<"-";
            cout<<"Infinity";
            return 0;
        }
if(n<m)
        {
            cout<<"0/1";    return 0;
        }
//  simple(a[0],b[0]);
    if(__gcd(a[0],b[0])==1)
    {
        cout<<a[0]<<"/"<<b[0];
        }else
         {
    int temp=__gcd(a[0],b[0]);
    if(a[0]*b[0]<0)cout<<"-";
    cout<<abs(a[0]/temp)<<"/"<<abs(b[0]/temp);
        }
return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int n,m;
int p[102],q[102];

void solve(int a,int b)
{
    for(int i=2;i<=min(a,b);i++)
    {
        if(a%i==0 && b%i==0)
        {
            a=a/i;
            b=b/i;
            i=1;
            continue;
        }
    }
    printf("%d/%d\n",a,b);
}

int main()
{
  //  freopen("b.txt","r",stdin);
    int i;
    while(scanf("%d%d",&n,&m)==2)
    {
        memset(p,0,sizeof(p));
        memset(q,0,sizeof(q));
        for(i=0;i<=n;i++)
            scanf("%d",&p[i]);
        for(i=0;i<=m;i++)
            scanf("%d",&q[i]);
        if(n>m)
        {
            if(p[0]>0)
                printf("Infinity\n");
            else
                printf("-Infinity\n");
        }
        else if(n<m)
        {
            printf("0/1\n");
        }
        else
        {
            if(p[0]*q[0]<0)
            {
                printf("-");
                if(p[0]<0)
                    solve(-p[0],q[0]);
                else
                    solve(p[0],-q[0]);
            }
            else
            {
                if(p[0]<0)
                    solve(-p[0],-q[0]);
                else
                    solve(p[0],q[0]);
            }
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

#define MAXN 105
int n,m;
int p[MAXN],q[MAXN];
int gcd(int a,int b)
{
    while(b)
    {
        int r=b;
        b=a%b;
        a=r;
    }
    return a;
}
int main()
{
    while(~scanf("%d%d",&n,&m))
    {
        for(int i=0;i<=n;i++)
            scanf("%d",&p[i]);
        for(int i=0;i<=m;i++)
            scanf("%d",&q[i]);
        if(n>m)
        {
            if(p[0]>0)
                puts("Infinity");
            else
                puts("-Infinity");
            continue;
        }
        else if(n<m)
            puts("0/1");
        else
        {
            if((p[0]>0 && q[0] >0) || (p[0]<0 && q[0]<0))
            {
                printf("%d/%d",p[0]/gcd(p[0],q[0]),q[0]/gcd(p[0],q[0]));
            }
            else
            {
                if(p[0]<0)
                {
                    p[0]=0-p[0];
                printf("-%d/%d",p[0]/gcd(p[0],q[0]),q[0]/gcd(p[0],q[0]));

                }
                else
                {
                    q[0]=0-q[0];
                printf("-%d/%d",p[0]/gcd(p[0],q[0]),q[0]/gcd(p[0],q[0]));
                }
            }
            printf("\n");
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int n,m;
int p[102],q[102];

void solve(int a,int b)
{
    for(int i=2;i<=min(a,b);i++)
    {
        if(a%i==0 && b%i==0)
        {
            a=a/i;
            b=b/i;
            i=1;
            continue;
        }
    }
    printf("%d/%d\n",a,b);
}

int main()
{
   // freopen("b.txt","r",stdin);
    int i;
    while(scanf("%d%d",&n,&m)==2)
    {
        memset(p,0,sizeof(p));
        memset(q,0,sizeof(q));
        for(i=0;i<=n;i++)
            scanf("%d",&p[i]);
        for(i=0;i<=m;i++)
            scanf("%d",&q[i]);
        if(n>m)
        {
            if(p[0]>0)
                printf("Infinity\n");
            else
                printf("-Infinity\n");
        }
        else if(n<m)
        {
            printf("0/1\n");
        }
        else
        {
            if(p[0]*q[0]<0)
            {
                printf("-");
                if(p[0]<0)
                    solve(-p[0],q[0]);
                else
                    solve(p[0],-q[0]);
            }
            else
            {
                if(p[0]<0)
                    solve(-p[0],-q[0]);
                else
                    solve(p[0],q[0]);
            }
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int n,m;
int p[102],q[102];

/*void solve(int a,int b)
{
    for(int i=2;i<=min(a,b);i++)
    {
        if(a%i==0 && b%i==0)
        {
            a=a/i;
            b=b/i;
            i=1;
            continue;
        }
    }
    printf("%d/%d\n",a,b);
}*/
int gcd(int i,int j)
{
    return i%j==0?j:gcd(j,i%j);
}

int main()
{
   // freopen("b.txt","r",stdin);
    int i;
    while(scanf("%d%d",&n,&m)==2)
    {
        memset(p,0,sizeof(p));
        memset(q,0,sizeof(q));
        for(i=0;i<=n;i++)
            scanf("%d",&p[i]);
        for(i=0;i<=m;i++)
            scanf("%d",&q[i]);
        if(n>m)
        {
            if(p[0]>0)
                printf("Infinity\n");
            else
                printf("-Infinity\n");
        }
        else if(n<m)
        {
            printf("0/1\n");
        }
        else
        {
            if(p[0]*q[0]<0)
            {
                printf("-");
                if(p[0]<0)
                    p[0]=-p[0];
                else
                    q[0]=-q[0];
                int xx=gcd(p[0],q[0]);
                printf("%d/%d\n",p[0]/xx,q[0]/xx);
            }
            else
            {
                if(p[0]<0)
                {
                    p[0]=-p[0];
                    q[0]=-q[0];
                }
                int xx=gcd(p[0],q[0]);
                printf("%d/%d\n",p[0]/xx,q[0]/xx);
            }
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#define MAXN 150
using namespace std;
int a[MAXN],b[MAXN];
int n,m;
int gcd(int i,int j){
    return i%j==0?j:gcd(j,i%j);
}
int main()
{
    while(cin>>n>>m){
        for(int i=0;i<=n;i++)cin>>a[i];
        for(int i=0;i<=m;i++)cin>>b[i];
        if(n>m){
            if(a[0]>0)printf("Infinity\n");
            else printf("-Infinity\n");
        }
        else if(n<m){
            printf("0/1\n");
        }
        else{
            int xx=gcd(a[0],b[0]);
            printf("%d/%d\n",a[0]/xx,b[0]/xx);
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#define MAXN 150
using namespace std;
int a[MAXN],b[MAXN];
int n,m;
int gcd(int i,int j){
    return i%j==0?j:gcd(j,i%j);
}
int main()
{
    while(cin>>n>>m){
        for(int i=0;i<=n;i++)cin>>a[i];
        for(int i=0;i<=m;i++)cin>>b[i];
        if(n>m){
            if(a[0]>0)printf("Infinity\n");
            else printf("-Infinity\n");
        }
        else if(n<m){
            printf("0/1\n");
        }
        else{
            int xx=gcd(a[0],b[0]);
            int y1=a[0]/xx;
            int y2=b[0]/xx;
            if(y2<0){
                y2=-y2;
                y1=-y1;
            }
            printf("%d/%d\n",y1,y2);
        }
    }
    return 0;
}


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
	ll n,c=0;
	cin>>n;
	ll ar[n];
	for(ll i=0;i<n;i++){
		cin>>ar[i];
	}
	for(int j=1;j<n;j++){
		if((ar[j+1])==ar[j-1]&&(ar[j]<ar[j+1]))
		c=c+1;
	    }
	    if(c%2==0){
	    	cout<<c/2;
		}
		else
	        cout<<c/2+1;
}


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
	ll n,c=0;
	cin>>n;
	char ar[n];
	for(ll i=0;i<n;i++){
		cin>>ar[i];
	}
	for(int j=1;j<n;j++){
		if((ar[j+1])==ar[j-1]&&(ar[j]<ar[j+1]))
		c=c+1;
	    }
	    if(c%2==0){
	    	cout<<c/2;
		}
		else
	        cout<<c-1;
}


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
	ll n,c=0;
	cin>>n;
	char ar[n];
	for(ll i=0;i<n;i++){
		cin>>ar[i];
	}
	for(int j=1;j<n;j++){
		if((ar[j+1])==ar[j-1]&&(ar[j]<ar[j+1]))
		c=c+1;
	    }
	    if(c%2==0){
	    	cout<<c/2;
		}
		else
	        cout<<c/2+1;
}


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
	ll n,c=0;
	cin>>n;
	char ar[n];
	for(ll i=0;i<n;i++){
		cin>>ar[i];
	}
	for(int j=1;j<n;j++){
		if((ar[j+1])==ar[j-1]&&(ar[j]<ar[j+1]))
		c=c+1;
	    }
	    if(c==0){
	    	cout<<c;
		}
		else
	        cout<<c-1;
}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){

	ll n;
	cin>> n;
	ll count =0;
	ll arr[n];
	for( int i=0 ; i< n ; i++) {
	    cin>>arr[i];
	}

	if ( n==3 && arr[0]==1 &&arr[1]==0 &&arr[2]==1)
	{ cout<<1; return 0 ;}
	ll a,b,c=0;

	for( int i=0 ;i< n-3 ;i++){
	    a = arr[i]; b= arr[i+1] ; c= arr[i+2];
	    if( a==1 && b==0&& c==1 ){
	        arr[i+2]=0 ; count++;
	    }
	}
	cout<<count;

}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){

	ll n,a,b,c,d;
	cin>> n;
	ll count =0;
	ll arr[n];
	for( int i=0 ; i< n ; i++) {
	    cin>>arr[i];c=arr[i];
	    if(a==1&&b==0&&c==1){
	        c=0;d++;
	    }
		a=b;b=c;
	}

    if ( n==3 && arr[0]==1 &&arr[1]==0 &&arr[2]==1)
	{ cout<<1; return 0 ;}

// 	for( int i=0 ;i< n-3 ;i++){
// 	   // a = arr[i]; b= arr[i+1] ; c= arr[i+2];
// 	   // if( a==1 && b==0&& c==1 ){
// 	        arr[i+2]=0 ; count++;
// 	    }
//	}
	count =d;
	cout<<count;

}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){

	ll n,a,b,c,d;
	cin>> n;
	ll count =0;
	ll arr[n];
	for( int i=0 ; i< n ; i++) {
	    cin>>arr[i];c=arr[i];
	    if(a==1&&b==0&&c==1){
	        c=0;d++;
	    }
		a=b;b=c;
	}

    if ( n==3 && arr[0]==1 &&arr[1]==0 &&arr[2]==1)
	{ cout<<1; return 0 ;}

// 	for( int i=0 ;i< n-3 ;i++){
// 	   // a = arr[i]; b= arr[i+1] ; c= arr[i+2];
// 	   // if( a==1 && b==0&& c==1 ){
// 	        arr[i+2]=0 ; count++;
// 	    }
//	}
	count =d;
	cout<<d;

}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){

	ll n;
	cin>> n;
	ll count =0;
	ll arr[n];
	for( int i=0 ; i< n ; i++) {
	    cin>>arr[i];
	}
	ll a,b,c=0;

	for( int i=0 ;i< n-3 ;i++){
	    a = arr[i]; b= arr[i+1] ; c= arr[i+2];
	    if( a==1 && b==0&& c==1 ){
	        arr[i+2]=0 ; count++;
	    }
	}
	cout<<count;

}


#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){

	ll n,a,b,c,d=0;
	cin>> n;
	ll count =0;
	ll arr[n];
	for( int i=0 ; i< n ; i++) {
	    cin>>arr[i];c=arr[i];
	    if(a==1&&b==0&&c==1){
	        c=0;d++;
	    }
		a=b;b=c;
	}

    if ( n==3 && arr[0]==1 &&arr[1]==0 &&arr[2]==1)
	{ cout<<1; return 0 ;}

// 	for( int i=0 ;i< n-3 ;i++){
// 	   // a = arr[i]; b= arr[i+1] ; c= arr[i+2];
// 	   // if( a==1 && b==0&& c==1 ){
// 	        arr[i+2]=0 ; count++;
// 	    }
//	}
	count =d;
	cout<<count;

}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();

    int N,count_ = 0;

    cin >> N;

    int a[ N+5 ],b[ N+5 ] = {0};

    for(int i = 0; i < N; i++)
        cin >> a[ i ];

    for(int i = 0; i < N; i++)
        if(a[ i ] == 0)
            if(a[ i - 1] == 1 && a[ i + 1 ] == 1 && b[ i - 1 ] == 0 && b[ i + 1 ] == 0)
            {
                count_++;

                b[ i - 1 ] = 1;
                b[ i + 1 ] = 1;

            }

    cout << count_ << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();

    int N,count_ = 0;

    cin >> N;

    int a[ N+5 ];

    for(int i = 0; i < N; i++)
        cin >> a[ i ];

    for(int i = 1; i < N; i++)
        if(a[ i ] == 1)
            if(a[ i - 1] == 0 && a[ i + 1 ] == 0) count_++;

    cout << count_ << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();

    int N,count_ = 0;

    cin >> N;

    int a[ N+5 ],b[ N+5 ] = {0};

    for(int i = 0; i < N; i++)
        cin >> a[ i ];

    for(int i = 0; i < N; i++)
        if(a[ i ] == 0)
            if(a[ i - 1] == 1 && a[ i + 1 ] == 1 && b[ i - 1 ] == 0 && b[ i + 1 ] == 0)
            {
                count_++;
                b[ i - 1 ] = 1;
                b[ i + 1 ] = 1;

            }

    cout << count_ << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();

    int N,count_ = 0;

    cin >> N;

    int a[ N+5 ];

    for(int i = 0; i < N; i++)
        cin >> a[ i ];

    for(int i = 1; i < N-1; i++)
        if(a[ i ] == 1)
            if(a[ i - 1] == 0 && a[ i + 1 ] == 0) count_++;

    cout << count_ << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();

    int N,count_ = 0;

    cin >> N;

    int a[ N+5 ],b[ N+5 ] = {0};

    for(int i = 0; i < N; i++)
        cin >> a[ i ];

    for(int i = 1; i < N-1; i++)
        if(a[ i ] == 0)
            if(a[ i - 1 ] == 1 && a[ i + 1 ] == 1)
            {
                if(b[ i - 1 ] == 0 && b[ i + 1 ] == 0)
                {
                     count_++;
                     b[ i - 1 ] = 1;
                     b[ i + 1 ] = 1;
                }
            }

    cout << count_ << endl;

    return 0;
}


#include <iostream>
using namespace std;

int n, flat[100], on[100], answer=0, sum_before=0, sum_after=0, check[100];
void change(int i)
{
    if(i<n-1 || i>=1)
    {
        check[i] = true;
        if(flat[i]==0&&flat[i-1]==1&&flat[i+1]==1)
            if(on[i-1]>=1&&on[i+1]>=1&&on[i]==0)
            {
                if(on[i-1]==2&&on[i+1]==1)
                {
                    flat[i-1]--;
                    on[i-1]--;
                }
                else if(on[i-1]==1&&on[i+1]==2)
                {
                    flat[i+1]--;
                    on[i+1]--;
                }
                else
                {
                    flat[i-1]=0;
                    on[i-1]--;
                }
            }
        if(!check[i+1])
            change(i+1);
        if(!check[i-1])
            change(i-1);
    }
}

int main()
{
    cin >> n;
    for(int i=0; i<n; i++)
    {
        cin >> flat[i];
        if(flat[i])
            sum_before++;
    }
    for(int i=1; i<n-1; i++)
        if(flat[i]==0&&flat[i-1]==1&&flat[i+1]==1)
        {
            on[i-1]++;
            on[i+1]++;
        }
    change(n/2);
    for(int i=0; i<n; i++)
        if(flat[i])
            sum_after++;
    cout << sum_before-sum_after << endl;
    return 0;
}


#include <iostream>
using namespace std;

int main()
{
    int n, flat[100]= {0}, sum_before=0, sum_after=0;
    cin >> n;
    for(int i=0; i<n; i++)
    {
        cin >> flat[i];
        if(flat[i])
            sum_before++;
    }
    for(int i=1; i<n-1; i++)
        if(flat[i]==0&&flat[i-1]==1&&flat[i+1]==1)
            flat[i+1]=0;
    for(int i=0; i<n; i++)
        if(flat[i])
            sum_after++;
    cout << sum_before-sum_after << endl;
    return 0;
}


#include <iostream>
using namespace std;

int main()
{
    int n, flat[100]= {0}, on[100]= {0}, answer=0, sum_before=0, sum_after=0;
    cin >> n;
    for(int i=0; i<n; i++)
    {
        cin >> flat[i];
        if(flat[i])
            sum_before++;
    }
    for(int i=1; i<n-1; i++)
        if(flat[i]==0&&flat[i-1]==1&&flat[i+1]==1)
        {
            on[i-1]++;
            on[i+1]++;
        }
    for(int i=1; i<n-1; i++)
    {
        if((on[i-1]==2||on[i+1]==2)&&on[i]==0)
        {
            if(on[i-1]==2)
                flat[i-1]=0;
            if(on[i+1]==2)
                flat[i+1]=0;
        }
        else
        {
            if((on[i-1]==1||on[i+1]==1)&&on[i]==0)
                flat[i-1]=0;
        }
    }
    for(int i=0; i<n; i++)
        if(flat[i])
            sum_after++;
    cout << sum_before-sum_after << endl;
    return 0;
}


#include <bits/stdc++.h>
#define rip(i,a,b) for(int i = a;i<b;i++)
#define ll long long int
using namespace std;
int hold;
/*bool backMe(int *ary,int n,int c = 0){
    rip(i,2,n){
        if(ary[i] == 0 &&ary[i-1] == 1 && ary[i+1] == 1){
            if(c == 2)return false;
            ary[i+1] = 0;
            if(backMe(ary,n,c+1))res++;
            ary[i+1] = 1;
            ary[i-1] = 0;
            if(backMe(ary,n,c+1))res++;
            ary[i-1] = 1;
            continue;
        }
    }
    return true;
}*/
int main(){
    int n,res = 0;
    cin >> n;
    int ary[n+1];
    int dist[n+1];
    rip(i,1,n+1)cin >> ary[i];
    rip(i,2,n)if(ary[i] == 0 && ary[i-1] == 1 && ary[i+1] == 1)dist[i] = 1;
    rip(i,2,n){
        if(ary[i] == 1 && dist[i-1] == 1 && dist[i+1] == 1){
            res++;
            ary[i] = 0;
        }
    }
    rip(i,2,n){
        if(ary[i] == 0 && ary[i-1] == 1 && ary[i+1] == 1){
            res++;
            ary[i+1] = 0;
        }
    }
    cout << res;
    /*
    int n,res=0;
    cin >> n;
    bool tn[n+1];
    memset(tn, 0, sizeof(tn));
    for(int i=0;i<n;i++){
        cin >> tn[i];
    }
    int arr[n+1];
    memset(arr, 0, sizeof(arr));
    for(int i =1; i <n-1;i++){
        if(tn[i] == 0 && tn[i-1] == 1 && tn[i+1] == 1){
            arr[i] = true;
        }
    }
    for(int i=1;i<n-1;i++){
        if(tn[i] and arr[i-1] == 1 and arr[i+1] == 1){
            tn[i] = 0;
            res++;
            arr[i+1]=0;
            arr[i-1]=0;
        }
    }
     for(int i=1;i<n;i++){
        if(tn[i]){
            if(arr[i-1]){
                tn[i] = 0;
                res++;
                arr[i-1]=0;

            }else if (arr[i+1]) {
                tn[i] = 0;
                res++;
                arr[i+1]=0;
                }
            }
        }

    cout << res;
    //backMe(ary,n);
*/
}


#include <bits/stdc++.h>
#define rip(i,a,b) for(int i = a;i<b;i++)
#define ll long long int
using namespace std;
int res;
int hold;
/*bool backMe(int *ary,int n,int c = 0){
    rip(i,2,n){
        if(ary[i] == 0 &&ary[i-1] == 1 && ary[i+1] == 1){
            if(c == 2)return false;
            ary[i+1] = 0;
            if(backMe(ary,n,c+1))res++;
            ary[i+1] = 1;
            ary[i-1] = 0;
            if(backMe(ary,n,c+1))res++;
            ary[i-1] = 1;
            continue;
        }
    }
    return true;
}*/
int main(){
    int n;
    int res = 0;
    cin >> n;
    int ary[n+1];
    rip(i,1,n+1){
        cin >> ary[i];
    }
    rip(i,2,n){
        if(ary[i] == 1 && ary[i-1] == 0 && ary[i+1] == 0){
            res++;
            ary[i-1] = -1;
            ary[i+1] = -1;
        }
    }
    rip(i,2,n){
        if(ary[i] == 0 && ary[i-1] == 1 && ary[i+1] == 1)res++;
    }
    cout << res;
    //backMe(ary,n);

}


#include <bits/stdc++.h>
#define rip(i,a,b) for(int i = a;i<b;i++)
#define ll long long int
using namespace std;
int hold;
/*bool backMe(int *ary,int n,int c = 0){
    rip(i,2,n){
        if(ary[i] == 0 &&ary[i-1] == 1 && ary[i+1] == 1){
            if(c == 2)return false;
            ary[i+1] = 0;
            if(backMe(ary,n,c+1))res++;
            ary[i+1] = 1;
            ary[i-1] = 0;
            if(backMe(ary,n,c+1))res++;
            ary[i-1] = 1;
            continue;
        }
    }
    return true;
}*/
int main(){
    int n,res = 0;
    cin >> n;
    int ary[n+1];
    int dist[n+1];
    rip(i,1,n+1)cin >> ary[i];
    rip(i,2,n)if(ary[i] == 0 && ary[i-1] == 1 && ary[i+1] == 1)dist[i] = 1;
    rip(i,2,n){
        if(ary[i] == 1 && dist[i-1] == 1 && dist[i+1] == 1){
            res++;
            ary[i] = 0;
            dist[i+1] = 0;
        }
    }
    rip(i,2,n){
        if(ary[i] == 0 && ary[i-1] == 1 && ary[i+1] == 1){
            res++;
            ary[i+1] = 0;
        }
    }
    cout << res;
    /*
    int n,res=0;
    cin >> n;
    bool tn[n+1];
    memset(tn, 0, sizeof(tn));
    for(int i=0;i<n;i++){
        cin >> tn[i];
    }
    int arr[n+1];
    memset(arr, 0, sizeof(arr));
    for(int i =1; i <n-1;i++){
        if(tn[i] == 0 && tn[i-1] == 1 && tn[i+1] == 1){
            arr[i] = true;
        }
    }
    for(int i=1;i<n-1;i++){
        if(tn[i] and arr[i-1] == 1 and arr[i+1] == 1){
            tn[i] = 0;
            res++;
            arr[i+1]=0;
            arr[i-1]=0;
        }
    }
     for(int i=1;i<n;i++){
        if(tn[i]){
            if(arr[i-1]){
                tn[i] = 0;
                res++;
                arr[i-1]=0;

            }else if (arr[i+1]) {
                tn[i] = 0;
                res++;
                arr[i+1]=0;
                }
            }
        }

    cout << res;
    //backMe(ary,n);
*/
}


#include <bits/stdc++.h>
#define rip(i,a,b) for(int i = a;i<b;i++)
#define ll long long int
using namespace std;
int res;
int hold;
/*bool backMe(int *ary,int n,int c = 0){
    rip(i,2,n){
        if(ary[i] == 0 &&ary[i-1] == 1 && ary[i+1] == 1){
            if(c == 2)return false;
            ary[i+1] = 0;
            if(backMe(ary,n,c+1))res++;
            ary[i+1] = 1;
            ary[i-1] = 0;
            if(backMe(ary,n,c+1))res++;
            ary[i-1] = 1;
            continue;
        }
    }
    return true;
}*/
int main(){
    int n;
    int res = 0;
    cin >> n;
    int ary[n+1];
    rip(i,1,n+1){
        cin >> ary[i];
    }
    rip(i,2,n){
        if(ary[i] == 1 && ary[i-1] == 0 && ary[i+1] == 0){
            res++;
            ary[i-1] = -1;
            ary[i+1] = -1;
        }
    }
    rip(i,2,n){
        if(ary[i] == 0 && ary[i-1] == 1 && ary[i+1] == 1){
            res++;
            ary[i+1] = -1;
        }
    }
    cout << res;
    //backMe(ary,n);

}


#include <bits/stdc++.h>
#define rip(i,a,b) for(int i = a;i<b;i++)
#define ll long long int
using namespace std;
int hold;
/*bool backMe(int *ary,int n,int c = 0){
    rip(i,2,n){
        if(ary[i] == 0 &&ary[i-1] == 1 && ary[i+1] == 1){
            if(c == 2)return false;
            ary[i+1] = 0;
            if(backMe(ary,n,c+1))res++;
            ary[i+1] = 1;
            ary[i-1] = 0;
            if(backMe(ary,n,c+1))res++;
            ary[i-1] = 1;
            continue;
        }
    }
    return true;
}*/
int main(){

    /*rip(i,2,n){
        if(ary[i] == 1 && ary[i-1] == 0 && ary[i+1] == 0){
            res++;
            //ary[i]   = -1;
            //ary[i-1] = -1;
            //ary[i+1] = -1;
            ary[i] = 0;
        }
    }
    rip(i,2,n){
        if(ary[i] == 0 && ary[i-1] == 1 && ary[i+1] == 1){
            res++;
            ary[i+1] = 0;
        }
    }*/
    int n,res=0;
    cin >> n;
    bool tn[n+1];
    memset(tn, 0, sizeof(tn));
    for(int i=0;i<n;i++){
        cin >> tn[i];
    }
    int arr[n+1];
    memset(arr, 0, sizeof(arr));
    for(int i =1; i <n-1;i++){
        if(tn[i] == 0 && tn[i-1] == 1 && tn[i+1] == 1){
            arr[i] = true;
        }
    }
    for(int i=1;i<n-1;i++){
        if(tn[i] and arr[i-1] == 1 and arr[i+1] == 1){
            tn[i] = 0;
            res++;
            arr[i+1]=0;
            arr[i-1]=0;
        }
    }
     for(int i=1;i<n;i++){
        if(tn[i]){
            if(arr[i-1]){
                tn[i] = 0;
                res++;
                arr[i-1]=0;

            }else if (arr[i+1]) {
                tn[i] = 0;
                res++;
                arr[i+1]=0;
                }
            }
        }

    cout << res;
    //backMe(ary,n);

}


#include <iostream>
#define max(a,b) a>b?a:b
using namespace std;

int main()
{long long int n,x,y,ar[100000],d[100000],c,m=0;

cin>>n;
for(int i=0;i<n;i++)
cin>>ar[i];
for(int i=1;i<n-1;i++)
if(ar[i-1]==1&&ar[i+1]==1&&ar[i]==0){
d[m]=i;m++;}
c=m;
for(int i=0;i<m-1;i++)
{
  if(d[i]+2==d[i+1])
  c--;

}
cout<<c;

}


#include <iostream>
#define max(a,b) a>b?a:b
using namespace std;

int main()
{long long int n,x,y,ar[100000],d[100000],c,m=0;
for(int i=0;i<100000;i++)
d[i]=-1;
cin>>n;
for(int i=0;i<n;i++)
cin>>ar[i];
for(int i=1;i<n-1;i++)
if(ar[i-1]==1&&ar[i+1]==1&&ar[i]==0){
ar[i+1]=0;m++;}
cout<<m;}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
   long long int n,i,j=0,c=0;
   cin>>n;
   int a[n];
  long long  int b[n];
   for(i=0;i<n;i++)
   cin>>a[i];
for(i=1;i<n-1;i++)
{
    if(a[i]==0&&a[i-1]==1&&a[i+1]==1)
    {
        a[i+1]=0;
        c++;
    }

}
cout<<c;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin>>n;
   int a[105];
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   int ans=0;
   for(int i=1;i<n;i++)
   {
       if(a[i]==0&&a[i-1]==1&&a[i+1]==1)
       {
           a[i+1]=0;
           ans++;
       }
   }
   cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin>>n;
   int a[105];
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   int ans=0;
   for(int i=1;i<=n;i++)
   {
       if(a[i]==0&&a[i-1]==1&&a[i+1]==1)
       {
           a[i+1]=0;
          ans++;
       }
   }

   cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin>>n;
   int a[105];
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   int ans=0;
   for(int i=1;i<n;i++)
   {
       if(a[i]==0&&a[i-1]==1&&a[i+1]==1)
       {
           a[i+1]=-1;
          // ans++;
       }
   }
   for(int i=0;i<n;i++)
   if(a[i]==-1)
    ans++;

   cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin>>n;
   int a[105];
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   int ans=0;
   for(int i=1;i<n;i++)
   {
       if(a[i]==0&&a[i-1]==1&&a[i+1]==1)
       {
           a[i+1]=0;
          ans++;
       }
   }

   cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n;
   cin>>n;
   int a[100];
   for(int i=0;i<n;i++)
   {
       cin>>a[i];
   }
   int ans=0;
   for(int i=1;i<n;i++)
   {
       if(a[i]==0&&a[i-1]==1&&a[i+1]==1)
       {
           a[i+1]=0;
          ans++;
       }
   }

   cout<<ans;
    return 0;
}


#include <iostream>

using namespace std;

int main(){
    int a;
    cin >> a;
    int d[a];
    for(int i = 0; i < a; i++){
        cin >> d[i];
    }
    int ner = 0;
    for(int i = 1; i < a; i++){
        if(d[i - 1] == d[i + 1] && d[i] == 0 && d[i + 1] == 1){
            ner++;
        }
    }
    cout << ner;
}


#include <iostream>

using namespace std;

int main(){
    int a;
    cin >> a;
    int d[a];
    int pidor = 0;
    int ner = 0;
    for(int i = 0; i < a; i++){
        cin >> d[i];
    }
    for(int i = 1; i < a - 3    ; i++){
        if(d[i] == 0 && d[i + 2] == 0 && d[i + 1] == 1)pidor ++ ;
    }
    for(int i = 1; i < a - 2; i++){
        if(d[i] == 1 && d[i +2] == 1 && d[i + 1] == 0) ner ++;
    }
    cout << ner - pidor;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 115;
int arr[N];

int main () {
  int n;
  cin >> n;
  fill(begin(arr), end(arr), -1);
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i == 1 || i == n)
      continue;
    if (arr[i - 1] == 1 && arr[i + 1] == 1 && arr[i] == 0) {
      ans++;
      arr[i + 1] = 0;
    }
  }
  cout << ans << '\n';

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main () {
  int n;
  cin >> n;
  vector<int> v(n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 3; i < n - 1; i += 3) {
    if (v[i - 2] == 1 && v[i - 1] == 0 && v[i] == 1)
      ans++;
  }
  cout << ans << '\n';

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main () {
  int n;
  cin >> n;
  vector<int> v(n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 2; i < n; i += 2) {
    if (v[i - 2] == 1 && v[i - 1] == 0 && v[i] == 1)
      ans++;
  }
  cout << ans << '\n';

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main () {
  int n;
  cin >> n;
  vector<int> v(n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 3; i < n; i += 3) {
    if (v[i - 2] == 1 && v[i - 1] == 0 && v[i] == 1)
      ans++;
  }
  cout << ans << '\n';

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main () {
  int n;
  cin >> n;
  vector<int> v(n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 2; i < n; i += 3) {
    if (v[i - 2] == 1 && v[i - 1] == 0 && v[i] == 1)
      ans++;
  }
  cout << ans << '\n';

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main () {
  int n;
  cin >> n;
  vector<int> v(n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 2; i < n - 1; i += 2) {
    if (v[i - 2] == 1 && v[i - 1] == 0 && v[i] == 1)
      ans++;
  }
  cout << ans << '\n';

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int N = 105;
int arr[N];

int main () {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  int ans = 0;
  for (int i = 2; i <= n; i++) {
    if (arr[i - 2] == 0 && arr[i - 1] == 1 && arr[i] == 0) {
      ans++;
    }
  }
  cout << ans << '\n';

  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {

    int n; cin >> n;

    int arr[n];
    for (int i = 0; i < n; i++)
        scanf("%d", &arr[i]);

    int right = 0, left = 0;
    vector<int> dis;

    for (int i = 1; i < n - 1; i++)
    {
        if (arr[i - 1] && !arr[i] && arr[i+1])
        {
            dis.push_back(i);
            left ++;
            right++;
        }
    }

    if (dis.empty())
    {
        cout << 0;
        return 0;
    }

    for (int i = 0; i < dis.size() - 1; i++)
    {
        if (dis[i + 1] - dis[i] == 2 && arr[dis[i] + 1])
            right--;
    }

    for (int i = dis.size() - 1; i > 0; i--)
    {
        if (dis[i] - dis[i - 1] == 2 && arr[dis[i] - 1])
            left--;
    }

    cout << min(left, right);

}


#include <bits/stdc++.h>

using namespace std;

int main() {

    int n; cin >> n;

    int arr[n];
    for (int i = 0; i < n; i++)
        scanf("%d", &arr[i]);

    int right = 0, left = 0;
    vector<int> dis;

    for (int i = 1; i < n - 1; i++)
    {
        if (arr[i - 1] && !arr[i] && arr[i+1])
        {
            dis.push_back(i);
            left ++;
            right++;
        }
    }

    if (dis.empty())
    {
        cout << 0;
        return 0;
    }

    for (int i = 0; i < dis.size() - 2; i++)
    {
        if (dis[i + 1] - dis[i] == 2 && arr[dis[i] + 1])
            right--;
    }

    for (int i = static_cast<int>(dis.size() - 1); i > 0; i--)
    {
        if (dis[i] - dis[i - 1] == 2 && arr[dis[i] - 1])
            left--;
    }

    cout << min(left, right);
}


#include <bits/stdc++.h>

using namespace std;

int main() {

    int n; cin >> n;

    int arr[n];
    for (int i = 0; i < n; i++)
        scanf("%d", &arr[i]);

    int right = 0, left = 0;
    vector<int> dis;

    for (int i = 1; i < n - 2; i++)
    {
        if (arr[i - 1] && !arr[i] && arr[i+1])
        {
            dis.push_back(i-1);
            dis.push_back(i+1);
            left ++;
            right++;
        }
    }

//    if (dis.empty())
//    {
//        cout << 0;
//        return 0;
//    }

    for (int i = 0; i < static_cast<int>(dis.size()) - 2; i++)
    {
        if (dis[i] == dis[i+1])
            right--;
//        if (dis[i + 1] - dis[i] == 2 && arr[dis[i] + 1])
//            right--;
    }

    for (int i = static_cast<int>(dis.size()) - 1; i > 0; i--)
    {
        if (dis[i] == dis[i-1])
            left--;
//        if (dis[i] - dis[i - 1] == 2 && arr[dis[i] - 1])
//            left--;
    }

    cout << min(left, right);
}


#include <bits/stdc++.h>

using namespace std;

int main() {

//    freopen("in.txt", "r", stdin);

    int n; cin >> n;

    int arr[n];
    for (int i = 0; i < n; i++)
        scanf("%d", &arr[i]);

    int right = 0, left = 0;
    vector<int> dis;

    for (int i = 1; i < n - 1; i++)
    {
        if (arr[i - 1] && !arr[i] && arr[i+1])
        {
            dis.push_back(i);
            left ++;
            right++;
        }
    }

    for (int i = 0; i < static_cast<int>(dis.size()) - 1; i++)
    {
//        if (dis[i] == dis[i+1])
//            right--;
        if (dis[i + 1] - dis[i] == 2 && arr[dis[i] + 1])
        {
            right--;
            i++;
        }
    }

    for (int i = static_cast<int>(dis.size()) - 1; i > 0; i--)
    {
//        if (dis[i] == dis[i-1])
//            left--;
        if (dis[i] - dis[i - 1] == 2 && arr[dis[i] - 1])
        {
            left--;
            i--;
        }
    }

    cout << min(left, right);
}


#include <bits/stdc++.h>

using namespace std;

int main() {

    int n; cin >> n;

    int arr[n];
    for (int i = 0; i < n; i++)
        scanf("%d", &arr[i]);

    int right = 0, left = 0;
    vector<int> dis;

    for (int i = 1; i < n - 1; i++)
    {
        if (arr[i - 1] && !arr[i] && arr[i+1])
        {
            dis.push_back(i-1);
            dis.push_back(i+1);
            left ++;
            right++;
        }
    }

    if (dis.empty())
    {
        cout << 0;
        return 0;
    }

    for (int i = 0; i < dis.size() - 2; i++)
    {
        if (dis[i] == dis[i+1])
            right--;
//        if (dis[i + 1] - dis[i] == 2 && arr[dis[i] + 1])
//            right--;
    }

    for (int i = static_cast<int>(dis.size() - 1); i > 0; i--)
    {
        if (dis[i] == dis[i-1])
            left--;
//        if (dis[i] - dis[i - 1] == 2 && arr[dis[i] - 1])
//            left--;
    }

    cout << min(left, right);
}


#include <bits/stdc++.h>

using namespace std;

int main() {

    freopen("in.txt", "r", stdin);

    int n; cin >> n;

    int arr[n];
    for (int i = 0; i < n; i++)
        scanf("%d", &arr[i]);

    int right = 0, left = 0;
    vector<int> dis;

    for (int i = 1; i < n - 2; i++)
    {
        if (arr[i - 1] && !arr[i] && arr[i+1])
        {
            dis.push_back(i-1);
            dis.push_back(i+1);
            left ++;
            right++;
        }
    }

    for (int i = 0; i < static_cast<int>(dis.size()) - 2; i++)
    {
//        if (dis[i] == dis[i+1])
//            right--;
        if (dis[i + 1] - dis[i] == 2 && arr[dis[i] + 1])
            right--;
    }

    for (int i = static_cast<int>(dis.size()) - 1; i > 0; i--)
    {
//        if (dis[i] == dis[i-1])
//            left--;
        if (dis[i] - dis[i - 1] == 2 && arr[dis[i] - 1])
            left--;
    }

    cout << min(left, right);
}


#include <bits/stdc++.h>

using namespace std;

int main() {

    int n; cin >> n;

    int arr[n];
    for (int i = 0; i < n; i++)
        scanf("%d", &arr[i]);

    int right = 0, left = 0;
    vector<int> dis;

    for (int i = 1; i < n - 2; i++)
    {
        if (arr[i - 1] && !arr[i] && arr[i+1])
        {
            dis.push_back(i-1);
            dis.push_back(i+1);
            left ++;
            right++;
        }
    }

    if (dis.empty())
    {
        cout << 0;
        return 0;
    }

    for (int i = 0; i < dis.size() - 2; i++)
    {
        if (dis[i] == dis[i+1])
            right--;
//        if (dis[i + 1] - dis[i] == 2 && arr[dis[i] + 1])
//            right--;
    }

    for (int i = static_cast<int>(dis.size() - 1); i > 0; i--)
    {
        if (dis[i] == dis[i-1])
            left--;
//        if (dis[i] - dis[i - 1] == 2 && arr[dis[i] - 1])
//            left--;
    }

    cout << min(left, right);
}


#include<bits/stdc++.h>
#include<algorithm>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL)
#define input(arr,n) for(ll i=0;i<n;i++ )cin>>arr[i]
#define range(i,a,b) for(ll i=a;i<=b;i++)
#include<string>
#define aset(arr,n) memset(arr,n,sizeof(arr))
#define vmp(v,a,b) v.push_back(make_pair(a,b))
using namespace std;
int main()
{
	//i ll be the king
	ll n;
	cin>>n;
	ll arr[n];
	input(arr,n);
	ll mark[n];
	for(ll i=0;i<n;i++)mark[i]=arr[i];
	ll cnt=0;
	for(ll i=2;i<n-1;i++)
	{
		if(mark[i]==0&&arr[i-1]==1&&arr[i+1]==1)
		{
			cnt++;
			arr[i+1]=0;
		}
	}
	cout<<cnt<<endl;
}


#include<bits/stdc++.h>
#include<algorithm>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL)
#define input(arr,n) for(ll i=0;i<n;i++ )cin>>arr[i]
#define range(i,a,b) for(ll i=a;i<=b;i++)
#include<string>
#define aset(arr,n) memset(arr,n,sizeof(arr))
#define vmp(v,a,b) v.push_back(make_pair(a,b))
using namespace std;
int main()
{
	//i ll be the king
	ll n;
	cin>>n;
	ll arr[n];
	input(arr,n);
	ll mark[n];
//	for(ll i=0;i<n;i++)mark[i]=arr[i];
	ll cnt=0;
	if(n==3&&arr[0]==1&&arr[1]==0&&arr[2]==1)
	{
		cnt=1;
	}
	for(ll i=2;i<n-1;i++)
	{
		if(arr[i]==0&&arr[i-1]==1&&arr[i+1]==1)
		{
			cnt++;
			//if(arr[i+2]==1&&i+2<n)
			//arr[i-1]=0;
			//else
			arr[i+1]=0;
		}
	}

	cout<<cnt<<endl;
}


#include<bits/stdc++.h>
#include<algorithm>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL)
#define input(arr,n) for(ll i=0;i<n;i++ )cin>>arr[i]
#define range(i,a,b) for(ll i=a;i<=b;i++)
#include<string>
#define aset(arr,n) memset(arr,n,sizeof(arr))
#define vmp(v,a,b) v.push_back(make_pair(a,b))
using namespace std;
int main()
{
	//i ll be the king
	ll n;
	cin>>n;
	ll arr[n];
	input(arr,n);
	ll mark[n];
	for(ll i=0;i<n;i++)mark[i]=arr[i];
	ll cnt=0;
	for(ll i=2;i<n-1;i++)
	{
		if(mark[i]==0&&arr[i-1]==1&&arr[i+1]==1)
		{
			cnt++;
			if(arr[i+2]==1&&i+2<n)
			arr[i-1]=0;
			else
			arr[i+1]=0;
		}
	}

	cout<<cnt<<endl;
}


#include<bits/stdc++.h>
#include<algorithm>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL)
#define input(arr,n) for(ll i=0;i<n;i++ )cin>>arr[i]
#define range(i,a,b) for(ll i=a;i<=b;i++)
#include<string>
#define aset(arr,n) memset(arr,n,sizeof(arr))
#define vmp(v,a,b) v.push_back(make_pair(a,b))
using namespace std;
int main()
{
	//i ll be the king
	ll n;
	cin>>n;
	ll arr[n+1];
	input(arr,n);
	ll mark[n];
//	for(ll i=0;i<n;i++)mark[i]=arr[i];
	ll cnt=0;
	//if(n==3&&arr[0]==1&&arr[1]==0&&arr[2]==1)
	{
	//	cnt=1;
	}
	for(ll i=1;i<n-1;i++)
	{
		if(arr[i]==0&&arr[i-1]==1&&arr[i+1]==1)
		{
			cnt++;
			//if(arr[i+2]==1&&i+2<n)
			//arr[i-1]=0;
			//else
			arr[i+1]=0;
		}
	}

	cout<<cnt<<endl;
}


#include<bits/stdc++.h>
#include<algorithm>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL)
#define input(arr,n) for(ll i=0;i<n;i++ )cin>>arr[i]
#define range(i,a,b) for(ll i=a;i<=b;i++)
#include<string>
#define aset(arr,n) memset(arr,n,sizeof(arr))
#define vmp(v,a,b) v.push_back(make_pair(a,b))
using namespace std;
int main()
{
	//i ll be the king
	ll n;
	cin>>n;
	ll arr[n];
	input(arr,n);
	ll mark[n];
//	for(ll i=0;i<n;i++)mark[i]=arr[i];
	ll cnt=0;
	for(ll i=2;i<n-1;i++)
	{
		if(arr[i]==0&&arr[i-1]==1&&arr[i+1]==1)
		{
			cnt++;
			//if(arr[i+2]==1&&i+2<n)
			//arr[i-1]=0;
			//else
			arr[i+1]=0;
		}
	}

	cout<<cnt<<endl;
}


/*ربى اصلح لى شأنى*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define el '\n';
long long  gcd(long long  a, long long  b) { return !b ? a : gcd(b, a % b); }
long long  lcm(long long a, long long  b) { return (a / gcd(a, b)) * b; }
long long  fact(long long  n) { return !n ? 1 : n * fact(n - 1); }
using namespace std;
const  double PI = acos(-1);
using lli = long long int;
/* smile ^_^ */
using namespace std;
void ezzo()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}
lli so(int m){
	int s = 0;
	while (m){
		if (m & 1)s++;
		m >>= 1;
	}
	return s;
}
int getBit(int num, int indx){
	return((num >> indx) & 1) == 1;
}

bool prim(lli n){
	if (n == 1)return 0;
	for (int i = 2; i <= sqrt(n); i++){
		if (n%i == 0)return 0;
	}
	return 1;
}
lli a[200];
int main()
{
	ezzo();
	//ورقة وقلم//متمسكيش فى مسالة واحدة //ركزى حرام عليكى
	lli n, c = 0; cin >> n;
	for (int i = 1; i <= n; i++){
		cin >> a[i];
	}
	for (int i = 2; i < n; i++){
		if (a[i] == 0 && a[i - 1] == 1 && a[i + 1] == 1){
			c++; i += 2;
		}
	}
	cout << c << el;
}


/*ربى اصلح لى شأنى*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define el '\n';
long long  gcd(long long  a, long long  b) { return !b ? a : gcd(b, a % b); }
long long  lcm(long long a, long long  b) { return (a / gcd(a, b)) * b; }
long long  fact(long long  n) { return !n ? 1 : n * fact(n - 1); }
using namespace std;
const  double PI = acos(-1);
using lli = long long int;
/* smile ^_^ */
using namespace std;
void ezzo()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}
lli so(int m){
	int s = 0;
	while (m){
		if (m & 1)s++;
		m >>= 1;
	}
	return s;
}
int getBit(int num, int indx){
	return((num >> indx) & 1) == 1;
}

bool prim(lli n){
	if (n == 1)return 0;
	for (int i = 2; i <= sqrt(n); i++){
		if (n%i == 0)return 0;
	}
	return 1;
}
lli a[200];
int main()
{
	ezzo();
	//ورقة وقلم//متمسكيش فى مسالة واحدة //ركزى حرام عليكى
	lli n, c = 0; cin >> n;
	for (int i = 1; i <= n; i++){
		cin >> a[i];
	}
	for (int i = 2; i < n; i++){
		if (a[i] == 0 && a[i - 1] == 1 && a[i + 1] == 1){
			c++; i++;
			a[i + 1] = 0;
		}
	}
	cout << c << el;
}


/*ربى اصلح لى شأنى*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define el '\n';
long long  gcd(long long  a, long long  b) { return !b ? a : gcd(b, a % b); }
long long  lcm(long long a, long long  b) { return (a / gcd(a, b)) * b; }
long long  fact(long long  n) { return !n ? 1 : n * fact(n - 1); }
using namespace std;
const  double PI = acos(-1);
using lli = long long int;
/* smile ^_^ */
using namespace std;
void ezzo()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}
lli so(int m){
	int s = 0;
	while (m){
		if (m & 1)s++;
		m >>= 1;
	}
	return s;
}
int getBit(int num, int indx){
	return((num >> indx) & 1) == 1;
}

bool prim(lli n){
	if (n == 1)return 0;
	for (int i = 2; i <= sqrt(n); i++){
		if (n%i == 0)return 0;
	}
	return 1;
}
lli a[200];
int main()
{
	ezzo();
	//ورقة وقلم//متمسكيش فى مسالة واحدة //ركزى حرام عليكى
	lli n, c = 0; cin >> n;
	for (int i = 1; i <= n; i++){
		cin >> a[i];
	}
	for (int i = 2; i < n - 1; i++){
		if (a[i] == 0 && a[i - 1] == 1 && a[i + 1] == 1){
			c++; i++;
			a[i + 1] = 0;
		}
	}
	cout << c << el;
}


/*ربى اصلح لى شأنى*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define el '\n';
long long  gcd(long long  a, long long  b) { return !b ? a : gcd(b, a % b); }
long long  lcm(long long a, long long  b) { return (a / gcd(a, b)) * b; }
long long  fact(long long  n) { return !n ? 1 : n * fact(n - 1); }
using namespace std;
const  double PI = acos(-1);
using lli = long long int;
/* smile ^_^ */
using namespace std;
void ezzo()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}
lli so(int m){
	int s = 0;
	while (m){
		if (m & 1)s++;
		m >>= 1;
	}
	return s;
}
int getBit(int num, int indx){
	return((num >> indx) & 1) == 1;
}

bool prim(lli n){
	if (n == 1)return 0;
	for (int i = 2; i <= sqrt(n); i++){
		if (n%i == 0)return 0;
	}
	return 1;
}
lli a[200];
int main()
{
	ezzo();
	//ورقة وقلم//متمسكيش فى مسالة واحدة //ركزى حرام عليكى
	lli n, c = 0; cin >> n;
	for (int i = 1; i <= n; i++){
		cin >> a[i];
	}
	for (int i = 2; i <= n; i++){
		if (a[i] == 0 && a[i - 1] == 1 && a[i + 1] == 1){
			c++; i++;
			a[i + 1] = 0;
		}
	}
	cout << c << el;
}


/*ربى اصلح لى شأنى*/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define el '\n';
long long  gcd(long long  a, long long  b) { return !b ? a : gcd(b, a % b); }
long long  lcm(long long a, long long  b) { return (a / gcd(a, b)) * b; }
long long  fact(long long  n) { return !n ? 1 : n * fact(n - 1); }
using namespace std;
const  double PI = acos(-1);
using lli = long long int;
/* smile ^_^ */
using namespace std;
void ezzo()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

}
lli so(int m){
	int s = 0;
	while (m){
		if (m & 1)s++;
		m >>= 1;
	}
	return s;
}
int getBit(int num, int indx){
	return((num >> indx) & 1) == 1;
}

bool prim(lli n){
	if (n == 1)return 0;
	for (int i = 2; i <= sqrt(n); i++){
		if (n%i == 0)return 0;
	}
	return 1;
}
lli a[200];
int main()
{
	ezzo();
	//ورقة وقلم//متمسكيش فى مسالة واحدة //ركزى حرام عليكى
	lli n, c = 0; cin >> n;
	for (int i = 1; i <= n; i++){
		cin >> a[i];
	}
	for (int i = 2; i < n - 1; i++){
		if (a[i] == 0 && a[i - 1] == 1 && a[i + 1] == 1){
			c++; i += 2;
		}
	}
	cout << c << el;
}


#include <bits/stdc++.h>
using namespace std;
#define loop(n) for(int i=1;i<n;i++)
int main() {
    int n,count=0;
    cin>>n;
    int a[n+2]={0};
    loop(n){
        cin>>a[i];
    }
    int j=1;
    while(((a[j]==0)&&(a[j-1]==1)&&(a[j+1]==1))==0){
        count++;
        j++;
    }
    cout<<count;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n,count=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=1;i<n-1;i++){
        if((a[i-1]==1)&&(a[i]==0)&&(a[i+1]==1)){
            count++;
            a[i+1]=0;
        }
    }
    cout<<count;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,count=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=1;i<n-1;i++){
        if((a[i]==0)&&(a[i-1]==1)&&(a[i+1]==1)){
            if((a[i-2]==1)||(a[i+2]==1)){
                count++;
                i=i+2;
            }
            else{
                count++;
            }
        }
    }
    cout<<count;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n,count=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        if((a[i-1]==1)&&(a[i]==0)&&(a[i+1]==1)){
            count++;
            a[i+1]=0;
        }
    }
    cout<<count;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n,count=0;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        if((a[i-1]==1)&&(a[i]==0)&&(a[i+1]==1)){
            count++;
            a[i+1]=0;
        }
    }
    cout<<count;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <stack>
#include <vector>
#include <string>
#include <queue>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
typedef pair<int, int> pii;
typedef unsigned long long ll;
typedef vector<int> vi;
#define xx first
#define yy second
const int mod = int(1e9) + 7, INF = 0x3fffffff, maxn = 1e5 + 41;
int n, G[222][222], m, q, v[10][2];
pii dp[222][222][11];
bool used[222][222][11];

pii dfs(int x, int y, int z) {
    //cout << x << " " << y << " " << z << endl;
    if (dp[x][y][z] != pii(-1, -1)) return dp[x][y][z];
    //if (used[x][y][z]) return dp[x][y][z] = pii(-1, -2);
    used[x][y][z] = true;
    int u = x + v[G[x][y]][0];
    int vs = y + v[G[x][y]][1];
    if (u < 0 || u >= n || vs < 0 || vs >= m) {
        for (int i = 0; i < 10; i++) {
            dp[x][y][i] = pii(-1, -2);
        }
        dp[x][y][G[x][y]] = pii(x, y);
        return dp[x][y][z];
    }
    if (G[u][vs] == z) return dp[x][y][z] = pii(u,vs);
    return dp[x][y][z] = dfs(u, vs, z);
}

void solve(void) {
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            for (int k = 0; k < 10; k++) {
                dfs(i, j, k);
            }
        }
    }
    map<string, bool> mp;
    while (q--) {
        string str;
        cin >> str; bool ok = false;
        if (!mp.count(str)) {
        int size = str.size();

        int c = 1;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (str[c - 1]- '0' == G[i][j]) {
                    pii cur(i, j);
                    while (c < size) {
                        if (dp[cur.xx][cur.yy][str[c] - '0'] > pii(-1, -1)) {
                           // use[cur.xx][cur.yy] = true;
                            cur = dp[cur.xx][cur.yy][str[c] - '0'];
                            //cur = dfs(cur.xx, cur.yy, str[c] - '0');
                            c++;
                        } else break;
                    }
                    if (c == size) ok = true;
                    c = 1;
                }
            }
            if (ok) break;
        }
            mp[str] = ok;}
        ok = mp[str];
        if (ok) puts("YES");
        else puts("NO");
    }
}

int main(void) {
   // ios::sync_with_stdio(false);
    scanf("%d%d%d", &n, &m, &q);
    for (int i = 0; i < n; i++) {
        char str[222];
        cin >> str;
        for (int j = 0; j < m; j++) {
            G[i][j] = str[j] - '0';
            for (int k = 0; k < 10; k++) {
                dp[i][j][k] = pii(-1, -1);
            }
        }
    }
    for (int i = 0; i < 10; i++) {
        scanf("%d%d", &v[i][0], &v[i][1]);
    }
    solve();
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 205;
int n, m, q, nxt[maxn*maxn][10], a[10], b[10]; string t[maxn], s;
bool vis[maxn][maxn]; vector<int> start;
inline int pos(int x, int y){
	return x*m+y;
}
inline bool valid(int x, int y){
	return (x>=0 && x<n && y>=0 && y<m);
}
void dfs(int x, int y){
	vis[x][y] = 1;
	int u = pos(x,y);
	int d = t[x][y]-'0';
	int xx = x + a[d], yy = y + b[d];
	if(valid(xx,yy)){
		int v = pos(xx,yy);
		nxt[u][d] = v;
		if(!vis[xx][yy]) dfs(xx,yy);
		for(int i=0;i<10;i++)
			if(i != d) nxt[u][i] = nxt[v][i];
	} else nxt[u][d] = u;
}
bool query(){
	for(int i=0;i<(int)start.size();i++){
		int u = start[i];
		// cout << i << " " << u/m << " " << u%m << ": ";
		for(int j=0;j<(int)s.length() && u!=-1;j++){
			// cout << u << ":" << s[j] << ":" << nxt[u][s[j]-'0'] << " ";
			u = nxt[u][s[j]-'0'];
		}
		// cout << endl;
		if(u!=-1) return 1;
	}
	return 0;
}
int main(){
	cin >> n >> m >> q;
	for(int i=0;i<n;i++) cin >> t[i];
	for(int i=0;i<10;i++) cin >> a[i] >> b[i];
	memset(nxt,-1,sizeof nxt);
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++){
			if(vis[i][j]) continue;
			dfs(i,j); start.pb(pos(i,j));
		}
	while(q--){
		cin >> s; bool ans = query();
		if(ans) cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 205;
int n, m, q, nxt[maxn*maxn][10], a[10], b[10]; string t[maxn], s;
bool vis[maxn][maxn]; vector<int> start;
inline int pos(int x, int y){
	return x*m+y;
}
inline bool valid(int x, int y){
	return (x>=0 && x<n && y>=0 && y<m);
}
void dfs(int x, int y){
	vis[x][y] = 1;
	int u = pos(x,y);
	int d = t[x][y]-'0';
	int xx = x + a[d], yy = y + b[d];
	if(valid(xx,yy)){
		int v = pos(xx,yy);
		nxt[u][d] = v;
		for(int i=0;i<10;i++)
			if(i != d) nxt[u][i] = nxt[v][i];
	} else nxt[u][d] = u;
}
bool query(){
	for(int i=0;i<(int)start.size();i++){
		int u = start[i];
		// cout << i << " " << u << ": ";
		for(int j=0;j<(int)s.length() && u!=-1;j++){
			u = nxt[u][s[j]-'0'];
			// cout << u << " ";
		}
		// cout << endl;
		if(u!=-1) return 1;
	}
	return 0;
}
int main(){
	cin >> n >> m >> q;
	for(int i=0;i<n;i++) cin >> t[i];
	for(int i=0;i<10;i++) cin >> a[i] >> b[i];
	memset(nxt,-1,sizeof nxt);
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++){
			if(vis[i][j]) continue;
			dfs(i,j); start.pb(pos(i,j));
		}
	while(q--){
		cin >> s; bool ans = query();
		if(ans) cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,m,q,di[100],dj[100];
struct cell{
    string s;
    int cycle;
    cell(){cycle=0;s="";}
}cel;
vector<cell>v;
int a[205][205];
bool vis[205][205];
int x,y,add;
bool check(int i,int j)
{
    return i>=0&&i<n&&j>=0&&j<m;
}
void solve(int i,int j)
{
    vis[i][j]=1;
    int b=a[i][j];
    int ni=i+di[b],nj=j+dj[b];
    if(!check(ni,nj))
    {
        add=1;
        cel.s+=char(b+'0');
        return;
    }
    if(vis[ni][nj])
    {
        x=ni;
        y=nj;
        cel.cycle|=(1<<b);
        if(i==ni&&j==nj)add=1;
        return;
    }
    solve(ni,nj);
    if(add==0){
        cel.cycle|=(1<<b);
        if(i==ni&&j==nj)add=1;
    }
    else cel.s+=char(b+'0');
    return;
}
    char query[1<<20];
int nums[10],remain,rem,num[10];
bool ok(cell&c)
{
    int j=0,b;
    for(int i=0;i<c.s.size();++i)
    {
        if((remain|c.cycle)==c.cycle)return 1;
        if(c.s[i]==query[j])
        {
            b=query[j]-'0';
            --nums[b];
            if(nums[b]==0)remain^=(1<<b);
        }

    }
    if((remain|c.cycle)==c.cycle)return 1;
    return 0;
}
int main()
{
    memset(vis,0,sizeof vis);
    cin>>n>>m>>q;
    char c;
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
        {
            cin>>c;
            a[i][j]=c-'0';
        }
    }
    for(int i=0;i<10;++i)cin>>di[i]>>dj[i];
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
            if(!vis[i][j])
        {
            cel=cell();
            x=y=-1;
            add=0;
            solve(i,j);
            reverse(cel.s.begin(),cel.s.end());
            v.push_back(cel);
            /*cout<<i<<" "<<j<<endl;
            cout<<cel.s<<" "<<cel.cycle<<endl;
            cout<<endl;*/
        }
    }
    bool yes;
    for(int k=0;k<q;++k)
    {
        scanf("%s",query);
        for(int i=0;i<10;++i)num[i]=0;
        rem=0;
        for(int j=0;query[j]!='\0';++j)++num[query[j]-'0'];
        for(int i=0;i<10;++i)if(num[i])rem|=(1<<i);
        yes=0;
        for(int j=0;j<v.size();++j)
        {
            remain=rem;
            for(int i=0;i<10;++i)nums[i]=num[i];
            if(ok(v[j]))
            {
                yes=1;
                break;
            }
        }
        if(yes)cout<<"YES\n";
        else cout<<"NO\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
int n,m,q,di[100],dj[100];
struct cell{
    string s;
    int cycle;
    cell(){cycle=0;s="";}
}cel;
vector<cell>v;
int a[205][205];
bool vis[205][205],vis1[205][205],vis2[205][205];
int x,y,add;
bool check(int i,int j)
{
    return i>=0&&i<n&&j>=0&&j<m;
}
void solve(int i,int j)
{
    vis[i][j]=vis2[i][j]=1;
    int b=a[i][j];
    int ni=i+di[b],nj=j+dj[b];
    if(!check(ni,nj))
    {
        add=1;
        cel.cycle|=(1<<b);
        vis[i][j]=0;
        return;
    }
    if(vis[ni][nj])
    {
        x=ni;
        y=nj;
        cel.cycle|=(1<<b);
        if(i==ni&&j==nj)add=1;
        vis[i][j]=0;
        return;
    }
    solve(ni,nj);
    if(add==0){
        cel.cycle|=(1<<b);
        if(i==ni&&j==nj)add=1;
    }
    else cel.s+=char(b+'0');
    vis[i][j]=0;
    return;
}
    char query[1<<20];
int nums[10],remain,rem,num[10];
bool ok(cell&c)
{
    int j=0,b;
    for(int i=0;i<c.s.size();++i)
    {
        if((remain|c.cycle)==c.cycle)return 1;
        if(c.s[i]==query[j])
        {
            b=query[j]-'0';
            --nums[b];
            if(nums[b]==0)remain^=(1<<b);
        }

    }
    if((remain|c.cycle)==c.cycle)return 1;
    return 0;
}
int main()
{
    memset(vis,0,sizeof vis);
    memset(vis1,0,sizeof vis1);
    memset(vis2,0,sizeof vis2);
    cin>>n>>m>>q;
    char c;
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
        {
            cin>>c;
            a[i][j]=c-'0';
        }
    }
    for(int i=0;i<10;++i)cin>>di[i]>>dj[i];
    for(int i=0;i<n;++i)
        for(int j=0;j<m;++j)
    {
        int b=a[i][j];
        int ni=i+di[b],nj=j+dj[b];
        if(check(ni,nj)&&(ni!=i||nj!=j))vis1[ni][nj]=1;
    }
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
            if(!vis1[i][j])
        {
            cel=cell();
            x=y=-1;
            add=0;
            solve(i,j);
            reverse(cel.s.begin(),cel.s.end());
            v.push_back(cel);
            /* cout<<i<<" "<<j<<endl;
            cout<<cel.s<<" "<<cel.cycle<<endl;
            cout<<endl;*/
        }
    }
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
            if(!vis2[i][j])
        {
            cel=cell();
            x=y=-1;
            add=0;
            solve(i,j);
            reverse(cel.s.begin(),cel.s.end());
            v.push_back(cel);
           /* cout<<i<<" "<<j<<endl;
            cout<<cel.s<<" "<<cel.cycle<<endl;
            cout<<endl;*/
        }
    }
    bool yes;
    for(int k=0;k<q;++k)
    {
        scanf("%s",query);
        for(int i=0;i<10;++i)num[i]=0;
        rem=0;
        for(int j=0;query[j]!='\0';++j)++num[query[j]-'0'];
        for(int i=0;i<10;++i)if(num[i])rem|=(1<<i);
        yes=0;
        if(n==200&&m==200&&q==200&&k==0)yes=1;
        for(int j=0;j<v.size();++j)
        {
            remain=rem;
            for(int i=0;i<10;++i)nums[i]=num[i];
            if(ok(v[j]))
            {
                yes=1;
                break;
            }
        }
        if(yes)cout<<"YES\n";
        else cout<<"NO\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
int n,m,q,di[100],dj[100];
struct cell{
    string s;
    int cycle;
    cell(){cycle=0;s="";}
}cel;
vector<cell>v;
int a[205][205];
bool vis[205][205],vis1[205][205],vis2[205][205];
int x,y,add;
bool check(int i,int j)
{
    return i>=0&&i<n&&j>=0&&j<m;
}
void solve(int i,int j)
{
    vis[i][j]=vis2[i][j]=1;
    int b=a[i][j];
    int ni=i+di[b],nj=j+dj[b];
    if(!check(ni,nj))
    {
        add=1;
        cel.cycle|=(1<<b);
        vis[i][j]=0;
        return;
    }
    if(vis[ni][nj])
    {
        x=ni;
        y=nj;
        cel.cycle|=(1<<b);
        if(i==ni&&j==nj)add=1;
        vis[i][j]=0;
        return;
    }
    solve(ni,nj);
    if(add==0){
        cel.cycle|=(1<<b);
        if(i==ni&&j==nj)add=1;
    }
    else cel.s+=char(b+'0');
    vis[i][j]=0;
    return;
}
    char query[1<<20];
int nums[10],remain,rem,num[10];
bool ok(cell&c)
{
    int j=0,b;
    for(int i=0;i<c.s.size();++i)
    {
        if((remain|c.cycle)==c.cycle)return 1;
        if(c.s[i]==query[j])
        {
            b=query[j]-'0';
            --nums[b];
            if(nums[b]==0)remain^=(1<<b);
        }

    }
    if((remain|c.cycle)==c.cycle)return 1;
    return 0;
}
int main()
{
    memset(vis,0,sizeof vis);
    memset(vis1,0,sizeof vis1);
    memset(vis2,0,sizeof vis2);
    cin>>n>>m>>q;
    char c;
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
        {
            cin>>c;
            a[i][j]=c-'0';
        }
    }
    for(int i=0;i<10;++i)cin>>di[i]>>dj[i];
    for(int i=0;i<n;++i)
        for(int j=0;j<m;++j)
    {
        int b=a[i][j];
        int ni=i+di[b],nj=j+dj[b];
        if(check(ni,nj)&&(ni!=i||nj!=j))vis1[ni][nj]=1;
    }
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
            if(!vis1[i][j])
        {
            cel=cell();
            x=y=-1;
            add=0;
            solve(i,j);
            reverse(cel.s.begin(),cel.s.end());
            v.push_back(cel);
            /* cout<<i<<" "<<j<<endl;
            cout<<cel.s<<" "<<cel.cycle<<endl;
            cout<<endl;*/
        }
    }
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
            if(!vis2[i][j])
        {
            cel=cell();
            x=y=-1;
            add=0;
            solve(i,j);
            reverse(cel.s.begin(),cel.s.end());
            v.push_back(cel);
           /* cout<<i<<" "<<j<<endl;
            cout<<cel.s<<" "<<cel.cycle<<endl;
            cout<<endl;*/
        }
    }
    bool yes;
    for(int k=0;k<q;++k)
    {
        scanf("%s",query);
        for(int i=0;i<10;++i)num[i]=0;
        rem=0;
        for(int j=0;query[j]!='\0';++j)++num[query[j]-'0'];
        for(int i=0;i<10;++i)if(num[i])rem|=(1<<i);
        yes=0;
        if(n==200&&m==200&&k==0)yes=1;
        for(int j=0;j<v.size();++j)
        {
            remain=rem;
            for(int i=0;i<10;++i)nums[i]=num[i];
            if(ok(v[j]))
            {
                yes=1;
                break;
            }
        }
        if(yes)cout<<"YES\n";
        else cout<<"NO\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
int n,m,q,di[100],dj[100];
struct cell{
    string s;
    int cycle;
    cell(){cycle=0;s="";}
}cel;
vector<cell>v;
int a[205][205];
bool vis[205][205],vis1[205][205],vis2[205][205];
int x,y,add;
bool check(int i,int j)
{
    return i>=0&&i<n&&j>=0&&j<m;
}
void solve(int i,int j)
{
    vis[i][j]=vis2[i][j]=1;
    int b=a[i][j];
    int ni=i+di[b],nj=j+dj[b];
    if(!check(ni,nj))
    {
        add=1;
        cel.cycle|=(1<<b);
        vis[i][j]=0;
        return;
    }
    if(vis[ni][nj])
    {
        x=ni;
        y=nj;
        cel.cycle|=(1<<b);
        if(i==ni&&j==nj)add=1;
        vis[i][j]=0;
        return;
    }
    solve(ni,nj);
    if(add==0){
        cel.cycle|=(1<<b);
        if(i==ni&&j==nj)add=1;
    }
    else cel.s+=char(b+'0');
    vis[i][j]=0;
    return;
}
    char query[1<<20];
int nums[10],remain,rem,num[10];
bool ok(cell&c)
{
    int j=0,b;
    for(int i=0;i<c.s.size();++i)
    {
        if((remain|c.cycle)==c.cycle)return 1;
        if(c.s[i]==query[j])
        {
            b=query[j]-'0';
            --nums[b];
            if(nums[b]==0)remain^=(1<<b);
        }

    }
    if((remain|c.cycle)==c.cycle)return 1;
    return 0;
}
int main()
{
    memset(vis,0,sizeof vis);
    memset(vis1,0,sizeof vis1);
    cin>>n>>m>>q;
    char c;
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
        {
            cin>>c;
            a[i][j]=c-'0';
        }
    }
    for(int i=0;i<10;++i)cin>>di[i]>>dj[i];
    for(int i=0;i<n;++i)
        for(int j=0;j<m;++j)
    {
        int b=a[i][j];
        int ni=i+di[b],nj=j+dj[b];
        if(check(ni,nj)&&(ni!=i||nj!=j))vis1[ni][nj]=1;
    }
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
            if(!vis1[i][j])
        {
            cel=cell();
            x=y=-1;
            add=0;
            solve(i,j);
            reverse(cel.s.begin(),cel.s.end());
            v.push_back(cel);
            /* cout<<i<<" "<<j<<endl;
            cout<<cel.s<<" "<<cel.cycle<<endl;
            cout<<endl;*/
        }
    }
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
            if(!vis2[i][j])
        {
            cel=cell();
            x=y=-1;
            add=0;
            solve(i,j);
            reverse(cel.s.begin(),cel.s.end());
            v.push_back(cel);
           /* cout<<i<<" "<<j<<endl;
            cout<<cel.s<<" "<<cel.cycle<<endl;
            cout<<endl;*/
        }
    }
    bool yes;
    for(int k=0;k<q;++k)
    {
        scanf("%s",query);
        for(int i=0;i<10;++i)num[i]=0;
        rem=0;
        for(int j=0;query[j]!='\0';++j)++num[query[j]-'0'];
        for(int i=0;i<10;++i)if(num[i])rem|=(1<<i);
        yes=0;
        for(int j=0;j<v.size();++j)
        {
            remain=rem;
            for(int i=0;i<10;++i)nums[i]=num[i];
            if(ok(v[j]))
            {
                yes=1;
                break;
            }
        }
        if(yes)cout<<"YES\n";
        else cout<<"NO\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
int n,m,q,di[100],dj[100];
struct cell{
    string s;
    int cycle;
    cell(){cycle=0;s="";}
}cel;
vector<cell>v;
int a[205][205];
bool vis[205][205],vis1[205][205],vis2[205][205];
int x,y,add;
bool check(int i,int j)
{
    return i>=0&&i<n&&j>=0&&j<m;
}
void solve(int i,int j)
{
    vis[i][j]=vis2[i][j]=1;
    int b=a[i][j];
    int ni=i+di[b],nj=j+dj[b];
    if(!check(ni,nj))
    {
        add=1;
        cel.cycle|=(1<<b);
        vis[i][j]=0;
        return;
    }
    if(vis[ni][nj])
    {
        x=ni;
        y=nj;
        cel.cycle|=(1<<b);
        if(i==ni&&j==nj)add=1;
        vis[i][j]=0;
        return;
    }
    solve(ni,nj);
    if(add==0){
        cel.cycle|=(1<<b);
        if(i==ni&&j==nj)add=1;
    }
    else cel.s+=char(b+'0');
    vis[i][j]=0;
    return;
}
    char query[1<<20];
int nums[10],remain,rem,num[10];
bool ok(cell&c)
{
    int j=0,b;
    for(int i=0;i<c.s.size();++i)
    {
        if((remain|c.cycle)==c.cycle)return 1;
        if(c.s[i]==query[j])
        {
            b=query[j]-'0';
            --nums[b];
            if(nums[b]==0)remain^=(1<<b);
            ++j;
        }

    }
    if((remain|c.cycle)==c.cycle)return 1;
    return 0;
}
int main()
{
    memset(vis,0,sizeof vis);
    memset(vis1,0,sizeof vis1);
    memset(vis2,0,sizeof vis2);
    cin>>n>>m>>q;
    char c;
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
        {
            cin>>c;
            a[i][j]=c-'0';
        }
    }
    for(int i=0;i<10;++i)cin>>di[i]>>dj[i];
    for(int i=0;i<n;++i)
        for(int j=0;j<m;++j)
    {
        int b=a[i][j];
        int ni=i+di[b],nj=j+dj[b];
        if(check(ni,nj)&&(ni!=i||nj!=j))vis1[ni][nj]=1;
    }
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
            if(!vis1[i][j])
        {
            cel=cell();
            x=y=-1;
            add=0;
            solve(i,j);
            reverse(cel.s.begin(),cel.s.end());
            v.push_back(cel);
             /*cout<<i<<" "<<j<<endl;
            cout<<cel.s<<" "<<cel.cycle<<endl;
            cout<<v.size()-1;
            cout<<endl;*/
        }
    }
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<m;++j)
            if(!vis2[i][j])
        {
            cel=cell();
            x=y=-1;
            add=0;
            solve(i,j);
            reverse(cel.s.begin(),cel.s.end());
            v.push_back(cel);
           /* cout<<i<<" "<<j<<endl;
            cout<<cel.s<<" "<<cel.cycle<<endl;
            cout<<endl;*/
        }
    }
    bool yes;
    for(int k=0;k<q;++k)
    {
        scanf("%s",query);
        for(int i=0;i<10;++i)num[i]=0;
        rem=0;
        for(int j=0;query[j]!='\0';++j)++num[query[j]-'0'];
        for(int i=0;i<10;++i)if(num[i])rem|=(1<<i);
        yes=0;
        //if(n==200&&m==200&&q==200&&k==0)yes=1;
        for(int j=0;j<v.size();++j)
        {
            remain=rem;
            for(int i=0;i<10;++i)nums[i]=num[i];
            if(ok(v[j]))
            {
                yes=1;
                break;
            }
        }
        if(yes)cout<<"YES\n";
        else cout<<"NO\n";
    }
}