//498A
//CrazyTown

import java.util.*;

public class CrazyTown
{

    static final double EPS = 1e-9;

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        Point home = new Point(sc.nextInt(), sc.nextInt());
        Point univ = new Point(sc.nextInt(), sc.nextInt());

        int n = sc.nextInt();
        int count = 0;
        LineSegment ls = new LineSegment(home, univ);
        while(n-->0)
        {
            Line l = new Line(sc.nextInt(), sc.nextInt(), sc.nextInt());
            if(ls.intersect(l))
                count++;
        }

        System.out.println(count);
    }

    static class Point implements Comparable<Point>
    {
        double x, y;

        public Point(double x, double y)
        {
            this.x = x;
            this.y = y;
        }

        public int compareTo(Point p)
        {
            if(Math.abs(this.x - p.x) > EPS)
                return this.x > p.x ? 1 : -1;
            if(Math.abs(this.y - p.y) > EPS)
                return this.y > p.y ? 1 : -1;
            return 0;
        }

        public double square(double x)
        {
            return x * x;
        }

        public double dist(Point p)
        {
            return Math.sqrt(square(this.x - p.x) + square(this.y - p.y));
        }

        public boolean isBetween(Point p, Point q)
        {
            return this.x < Math.max(p.x, q.x) + EPS && this.x + EPS > Math.min(p.x, q.x) &&
                   this.y < Math.max(p.y, q.y) + EPS && this.y + EPS > Math.min(p.y, q.y);
        }

        public String toString()
        {
            return this.x + " " + this.y;
        }
    }

    static class Line
    {
        double a, b, c;

        public Line(double a, double b, double c)
        {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        public Line(Point p1, Point p2)
        {
            if(Math.abs(p1.x - p2.x) < EPS)
            {
                this.a = 1.0;
                this.b = 0.0;
                this.c = -p1.x;
            }
            else
            {
                this.a = - ((p1.y - p2.y) / (p1.x - p2.x));
                this.b = 1.0;
                this.c = - (this.a * p1.x + p1.y);
            }
        }

        public boolean isParallel(Line l)
        {
            return Math.abs(this.a - l.a) < EPS && Math.abs(this.b - l.b) < EPS;
        }

        public boolean isSame(Line l)
        {
            return this.isParallel(l) && Math.abs(this.c - l.c) < EPS;
        }

        public double getX(double y)
        {
            return - (this.b * y + this.c) / this.a;
        }

        public Point intersect(Line l)
        {
            if(isParallel(l)) return null;

            double x = ((this.b * l.c) - (this.c * l.b)) /  ((this.a * l.b) - (this.b * l.a));
            double y;

            if(this.b < EPS)
                y = - (l.a * x + l.c) / l.b;
            else
                y = - (this.a * x + this.c) / this.b;

            return new Point(x, y);
        }
    }

    static class LineSegment
    {
        Point p, q;

        public LineSegment(Point p, Point q)
        {
            this.p = p;
            this.q = q;
        }

        public boolean intersect(LineSegment ls)
        {
            Line l1 = new Line(this.p, this.q);
            Line l2 = new Line(ls.p, ls.q);

            if(l1.isParallel(l2))
            {
                if(l1.isSame(l2))
                    return this.p.isBetween(ls.p, ls.q)   || this.q.isBetween(ls.p, ls.q) ||
                           ls.p.isBetween(this.p, this.q) || ls.q.isBetween(this.p, this.q);
                return false;
            }

            Point intersect = l1.intersect(l2);
            return intersect.isBetween(this.p, this.q) && intersect.isBetween(ls.p, ls.q);
        }

        public boolean intersect(Line l)
        {
            Line l1 = new Line(this.p, this.q);
            Point intersect = l1.intersect(l);
            if(intersect == null) return false;
            return intersect.isBetween(this.p, this.q);
        }
    }
}


//498A
//CrazyTown

import java.util.*;

public class CrazyTown
{

    static final double EPS = 1e-9;

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        Point home = new Point(sc.nextInt(), sc.nextInt());
        Point univ = new Point(sc.nextInt(), sc.nextInt());

        int n = sc.nextInt();
        int count = 0;
        LineSegment ls = new LineSegment(home, univ);
        while(n-->0)
        {
            Line l = new Line(sc.nextInt(), sc.nextInt(), sc.nextInt());
            if(ls.intersect(l))
                count++;
        }

        System.out.println(count);
    }

    static class Point implements Comparable<Point>
    {
        double x, y;

        public Point(double x, double y)
        {
            this.x = x;
            this.y = y;
        }

        public int compareTo(Point p)
        {
            if(Math.abs(this.x - p.x) > EPS)
                return this.x > p.x ? 1 : -1;
            if(Math.abs(this.y - p.y) > EPS)
                return this.y > p.y ? 1 : -1;
            return 0;
        }

        public double square(double x)
        {
            return x * x;
        }

        public double dist(Point p)
        {
            return Math.sqrt(square(this.x - p.x) + square(this.y - p.y));
        }

        public boolean isBetween(Point p, Point q)
        {
            return this.x < Math.max(p.x, q.x) + EPS && this.x + EPS > Math.min(p.x, q.x) &&
                   this.y < Math.max(p.y, q.y) + EPS && this.y + EPS > Math.min(p.y, q.y);
        }

        public String toString()
        {
            return this.x + " " + this.y;
        }
    }

    static class Line
    {
        double a, b, c;

        public Line(double a, double b, double c)
        {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        public Line(Point p1, Point p2)
        {
            if(Math.abs(p1.x - p2.x) < EPS)
            {
                this.a = 1.0;
                this.b = 0.0;
                this.c = -p1.x;
            }
            else
            {
                this.a = - ((p1.y - p2.y) / (p1.x - p2.x));
                this.b = 1.0;
                this.c = - (this.a * p1.x + p1.y);
            }
        }

        public boolean isParallel(Line l)
        {
            return Math.abs(this.a - l.a) < EPS && Math.abs(this.b - l.b) < EPS;
        }

        public boolean isSame(Line l)
        {
            return this.isParallel(l) && Math.abs(this.c - l.c) < EPS;
        }

        public double getX(double y)
        {
            return - (this.b * y + this.c) / this.a;
        }

        public Point intersect(Line l)
        {
            if(isParallel(l)) return null;

            double x = ((this.b * l.c) - (this.c * l.b)) /  ((this.a * l.b) - (this.b * l.a));
            double y;

            if(this.b < EPS)
                y = - (l.a * x + l.c);
            else
                y = - (this.a * x + this.c);

            return new Point(x, y);
        }
    }

    static class LineSegment
    {
        Point p, q;

        public LineSegment(Point p, Point q)
        {
            this.p = p;
            this.q = q;
        }

        public boolean intersect(LineSegment ls)
        {
            Line l1 = new Line(this.p, this.q);
            Line l2 = new Line(ls.p, ls.q);

            if(l1.isParallel(l2))
            {
                if(l1.isSame(l2))
                    return this.p.isBetween(ls.p, ls.q)   || this.q.isBetween(ls.p, ls.q) ||
                           ls.p.isBetween(this.p, this.q) || ls.q.isBetween(this.p, this.q);
                return false;
            }

            Point intersect = l1.intersect(l2);
            return intersect.isBetween(this.p, this.q) && intersect.isBetween(ls.p, ls.q);
        }

        public boolean intersect(Line l)
        {
            Line l1 = new Line(this.p, this.q);
            Point intersect = l1.intersect(l);
            if(intersect == null) return false;
            return intersect.isBetween(this.p, this.q);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class CrazyTown {
	public static void main(String[]args) throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer st = new StringTokenizer(br.readLine());
	Long x1=Long.parseLong(st.nextToken());
	Long y1=Long.parseLong(st.nextToken());
	st = new StringTokenizer(br.readLine());
	Long x2=Long.parseLong(st.nextToken());
	Long y2=Long.parseLong(st.nextToken());
	int x=Integer.parseInt(br.readLine());
	int y=0;
	for(int i=0;i<x;i++){
		st = new StringTokenizer(br.readLine());
		Long a = Long.parseLong(st.nextToken());
		Long b = Long.parseLong(st.nextToken());
		Long c = Long.parseLong(st.nextToken());
		if((a*x1+b*y1+c<0&&a*x2+b*y2+c>0)||(a*x1+b*y1+c>0&&a*x2+b*y2+c<0)){
			y++;
		}
	}
	System.out.println(y);
	}

}


import java.util.*;
public class Codeforces1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		//System.out.print("Enter your home coordinates ");
		//String Line =sc.nextLine();
		StringTokenizer st =new StringTokenizer(sc.nextLine());

		double xh = Integer.parseInt(st.nextToken());
        double yh = Integer.parseInt(st.nextToken());
        //System.out.print("Enter your university coordinates ");
        st = new StringTokenizer(sc.nextLine());
        double xu= Integer.parseInt(st.nextToken());
        double yu= Integer.parseInt(st.nextToken());
        //System.out.print("Enter the number of roads ");
        st = new StringTokenizer(sc.nextLine());
        int N= Integer.parseInt(st.nextToken());
        int a[][] = new int [N][3];

        for(int i=0; i<N; i++){
        	StringTokenizer stt = new StringTokenizer(sc.nextLine());
        	a[i][0] = Integer.parseInt(stt.nextToken());
        	a[i][1] = Integer.parseInt(stt.nextToken());
        	a[i][2] = Integer.parseInt(stt.nextToken());
        }

        /*
        System.out.println("coords are :" + xh + " "+yh+" "+xu+" "+ yu);
        for(int i=0; i<N; i++){
        	System.out.println("Lines : " + a[i][0] + " " + a[i][1] + " " + a[i][2]);
        }
        */
        int i=0;
        int sum=0;
        while(i<N){
if (a[i][1]==0){
	/*int x1=((-(a [i][2]))\(a[i][0]));*/
	double s = -a[i][2];
	double z = a[i][0];
	double M =(s)/(z);
	if(xh>M&&xu<M){
		sum=sum+1;
	}else{
		if(xh<M&&xu>M){
			sum=sum+1;

		}
	}
}
else{
        	double y1= ((-a[i][2]/(a[i][1]))+(-(a[i][0])*xh/(a[i][1])));
        	double y2=((-a[i][2]/(a[i][1]))+(-(a[i][0])*xu/(a[i][1])));
        	if (yh>y1&&yu<y2){
        		sum=sum+1;
        	}else{
        		if(yh<y1&&yu>y2){
        			sum=sum+1;
        		}

        	}

        }
i++;

	}
        System.out.println(sum);

}
}


import java.util.*;
public class Codeforces1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		//System.out.print("Enter your home coordinates ");
		//String Line =sc.nextLine();
		StringTokenizer st =new StringTokenizer(sc.nextLine());

		int xh = Integer.parseInt(st.nextToken());
        int yh = Integer.parseInt(st.nextToken());
        //System.out.print("Enter your university coordinates ");
        st = new StringTokenizer(sc.nextLine());
        int xu= Integer.parseInt(st.nextToken());
        int yu= Integer.parseInt(st.nextToken());
        //System.out.print("Enter the number of roads ");
        st = new StringTokenizer(sc.nextLine());
        int N= Integer.parseInt(st.nextToken());
        int a[][] = new int [N][3];

        for(int i=0; i<N; i++){
        	StringTokenizer stt = new StringTokenizer(sc.nextLine());
        	a[i][0] = Integer.parseInt(stt.nextToken());
        	a[i][1] = Integer.parseInt(stt.nextToken());
        	a[i][2] = Integer.parseInt(stt.nextToken());
        }

        /*
        System.out.println("coords are :" + xh + " "+yh+" "+xu+" "+ yu);
        for(int i=0; i<N; i++){
        	System.out.println("Lines : " + a[i][0] + " " + a[i][1] + " " + a[i][2]);
        }
        */

        int i=0;
        int sum=0;
        int x1=0;
        while(i<N){
if (a[i][1]==0){
	/*int x1=((-(a [i][2]))\(a[i][0]));*/
	x1=-a[i][2]/a[i][0];
	if(xh>x1&&xu<x1){
		sum=sum+1;
	}else{
		if(xh<x1&&xu>x1){
			sum=sum+1;

		}
	}
}
else{
        	int y1= ((-a[i][2])-((a[i][0])*xh)/(a[i][1]));
        	int y2=((-a[i][2])-((a[i][0])*xu)/(a[i][1]));
        	if (yh>y1&&yu<y2){
        		sum=sum+1;
        	}else{
        		if(yh<y1&&yu>y2){
        			sum=sum+1;
        		}

        	}

        }
i++;

	}
        System.out.println(sum);

}
}


import java.util.*;
public class Codeforces1 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        //System.out.print("Enter your home coordinates ");
        //String Line =sc.nextLine();
        StringTokenizer st =new StringTokenizer(sc.nextLine());

        double xh = Integer.parseInt(st.nextToken());
        double yh = Integer.parseInt(st.nextToken());
        //System.out.print("Enter your university coordinates ");
        st = new StringTokenizer(sc.nextLine());
        double xu= Integer.parseInt(st.nextToken());
        double yu= Integer.parseInt(st.nextToken());
        //System.out.print("Enter the number of roads ");
        st = new StringTokenizer(sc.nextLine());
        int N= Integer.parseInt(st.nextToken());
        int a[][] = new int [N][3];

        for(int i=0; i<N; i++){
            StringTokenizer stt = new StringTokenizer(sc.nextLine());
            a[i][0] = Integer.parseInt(stt.nextToken());
            a[i][1] = Integer.parseInt(stt.nextToken());
            a[i][2] = Integer.parseInt(stt.nextToken());
        }

        /*
        System.out.println("coords are :" + xh + " "+yh+" "+xu+" "+ yu);
        for(int i=0; i<N; i++){
            System.out.println("Lines : " + a[i][0] + " " + a[i][1] + " " + a[i][2]);
        }
        */

        int i=0;
        double sum=0;
        double x1=0;
        while(i<N){
if (a[i][1]==0){
    /*int x1=((-(a [i][2]))\(a[i][0]));*/
    x1=-a[i][2]/a[i][0];
    if(xh>x1&&xu<x1){
        sum=sum+1;
    }else{
        if(xh<x1&&xu>x1){
            sum=sum+1;

        }
    }
}
else{
            double y1= ((-a[i][2]/(a[i][1]))+(-(a[i][0])*xh/(a[i][1])));
            double y2=((-a[i][2]/(a[i][1]))+(-(a[i][0])*xu/(a[i][1])));
            if (yh>y1&&yu<y2){
                sum=sum+1;
            }else{
                if(yh<y1&&yu>y2){
                    sum=sum+1;
                }

            }

        }
i++;

    }
        System.out.println(sum);

}
}


import java.util.*;
public class Codeforces1 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        //System.out.print("Enter your home coordinates ");
        //String Line =sc.nextLine();
        StringTokenizer st =new StringTokenizer(sc.nextLine());

        int xh = Integer.parseInt(st.nextToken());
        int yh = Integer.parseInt(st.nextToken());
        //System.out.print("Enter your university coordinates ");
        st = new StringTokenizer(sc.nextLine());
        int xu= Integer.parseInt(st.nextToken());
        int yu= Integer.parseInt(st.nextToken());
        //System.out.print("Enter the number of roads ");
        st = new StringTokenizer(sc.nextLine());
        int N= Integer.parseInt(st.nextToken());
        int a[][] = new int [N][3];

        for(int i=0; i<N; i++){
            StringTokenizer stt = new StringTokenizer(sc.nextLine());
            a[i][0] = Integer.parseInt(stt.nextToken());
            a[i][1] = Integer.parseInt(stt.nextToken());
            a[i][2] = Integer.parseInt(stt.nextToken());
        }

        /*
        System.out.println("coords are :" + xh + " "+yh+" "+xu+" "+ yu);
        for(int i=0; i<N; i++){
            System.out.println("Lines : " + a[i][0] + " " + a[i][1] + " " + a[i][2]);
        }
        */

        int i=0;
        int sum=0;
        int x1=0;
        while(i<N){
if (a[i][1]==0){
    /*int x1=((-(a [i][2]))\(a[i][0]));*/
    x1=-a[i][2]/a[i][0];
    if(xh>x1&&xu<x1){
        sum=sum+1;
    }else{
        if(xh<x1&&xu>x1){
            sum=sum+1;

        }
    }
}
else{
            int y1= ((-a[i][2]/(a[i][1]))+(-(a[i][0])*xh/(a[i][1])));
            int y2=((-a[i][2]/(a[i][1]))+(-(a[i][0])*xu/(a[i][1])));
            if (yh>y1&&yu<y2){
                sum=sum+1;
            }else{
                if(yh<y1&&yu>y2){
                    sum=sum+1;
                }

            }

        }
i++;

    }
        System.out.println(sum);

}
}


import java.util.*;
public class Codeforces1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		//System.out.print("Enter your home coordinates ");
		//String Line =sc.nextLine();
		StringTokenizer st =new StringTokenizer(sc.nextLine());

		double xh = Integer.parseInt(st.nextToken());
        double yh = Integer.parseInt(st.nextToken());
        //System.out.print("Enter your university coordinates ");
        st = new StringTokenizer(sc.nextLine());
        double xu= Integer.parseInt(st.nextToken());
        double yu= Integer.parseInt(st.nextToken());
        //System.out.print("Enter the number of roads ");
        st = new StringTokenizer(sc.nextLine());
        int N= Integer.parseInt(st.nextToken());
        int a[][] = new int [N][3];

        for(int i=0; i<N; i++){
        	StringTokenizer stt = new StringTokenizer(sc.nextLine());
        	a[i][0] = Integer.parseInt(stt.nextToken());
        	a[i][1] = Integer.parseInt(stt.nextToken());
        	a[i][2] = Integer.parseInt(stt.nextToken());
        }

        /*
        System.out.println("coords are :" + xh + " "+yh+" "+xu+" "+ yu);
        for(int i=0; i<N; i++){
        	System.out.println("Lines : " + a[i][0] + " " + a[i][1] + " " + a[i][2]);
        }
        */

        int i=0;
        long sum=0;
        double x1=0;
        while(i<N){
if (a[i][1]==0){
	/*int x1=((-(a [i][2]))\(a[i][0]));*/
	x1=-a[i][2]/a[i][0];
	if(xh>x1&&xu<x1){
		sum=sum+1;
	}else{
		if(xh<x1&&xu>x1){
			sum=sum+1;

		}
	}
}
else{
        	double y1= ((-a[i][2]/(a[i][1]))+(-(a[i][0])*xh/(a[i][1])));
        	double y2=((-a[i][2]/(a[i][1]))+(-(a[i][0])*xu/(a[i][1])));
        	if (yh>y1&&yu<y2){
        		sum=sum+1;
        	}else{
        		if(yh<y1&&yu>y2){
        			sum=sum+1;
        		}

        	}

        }
i=i+1;

	}
        System.out.println(sum);

}
}


import java.util.*;
public class Codeforces1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		//System.out.print("Enter your home coordinates ");
		//String Line =sc.nextLine();
		StringTokenizer st =new StringTokenizer(sc.nextLine());

		double xh = Integer.parseInt(st.nextToken());
        double yh = Integer.parseInt(st.nextToken());
        //System.out.print("Enter your university coordinates ");
        st = new StringTokenizer(sc.nextLine());
        double xu= Integer.parseInt(st.nextToken());
        double yu= Integer.parseInt(st.nextToken());
        //System.out.print("Enter the number of roads ");
        st = new StringTokenizer(sc.nextLine());
        int N= Integer.parseInt(st.nextToken());
        int a[][] = new int [N][3];

        for(int i=0; i<N; i++){
        	StringTokenizer stt = new StringTokenizer(sc.nextLine());
        	a[i][0] = Integer.parseInt(stt.nextToken());
        	a[i][1] = Integer.parseInt(stt.nextToken());
        	a[i][2] = Integer.parseInt(stt.nextToken());
        }

        /*
        System.out.println("coords are :" + xh + " "+yh+" "+xu+" "+ yu);
        for(int i=0; i<N; i++){
        	System.out.println("Lines : " + a[i][0] + " " + a[i][1] + " " + a[i][2]);
        }
        */

        int i=0;
        long sum=0;
        double x1=0;
        while(i<N){
if (a[i][1]==0){
	/*int x1=((-(a [i][2]))\(a[i][0]));*/
	x1=-a[i][2]/a[i][0];
	if(xh>x1&&xu<x1){
		sum=sum+1;
	}else{
		if(xh<x1&&xu>x1){
			sum=sum+1;

		}
	}
}
else{
        	double y1= ((-a[i][2]/(a[i][1]))+(-(a[i][0])*xh/(a[i][1])));
        	double y2=((-a[i][2]/(a[i][1]))+(-(a[i][0])*xu/(a[i][1])));
        	if (yh>y1&&yu<y2){
        		sum=sum+1;
        	}else{
        		if(yh<y1&&yu>y2){
        			sum=sum+1;
        		}

        	}

        }
i++;

	}
        System.out.println(sum);

}
}


import java.util.*;
public class Codeforces1 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        //System.out.print("Enter your home coordinates ");
        //String Line =sc.nextLine();
        StringTokenizer st =new StringTokenizer(sc.nextLine());

        double xh = Integer.parseInt(st.nextToken());
        double yh = Integer.parseInt(st.nextToken());
        //System.out.print("Enter your university coordinates ");
        st = new StringTokenizer(sc.nextLine());
        double xu= Integer.parseInt(st.nextToken());
        double yu= Integer.parseInt(st.nextToken());
        //System.out.print("Enter the number of roads ");
        st = new StringTokenizer(sc.nextLine());
        int N= Integer.parseInt(st.nextToken());
        int a[][] = new int [N][3];

        for(int i=0; i<N; i++){
            StringTokenizer stt = new StringTokenizer(sc.nextLine());
            a[i][0] = Integer.parseInt(stt.nextToken());
            a[i][1] = Integer.parseInt(stt.nextToken());
            a[i][2] = Integer.parseInt(stt.nextToken());
        }

        /*
        System.out.println("coords are :" + xh + " "+yh+" "+xu+" "+ yu);
        for(int i=0; i<N; i++){
            System.out.println("Lines : " + a[i][0] + " " + a[i][1] + " " + a[i][2]);
        }
        */

        int i=0;
        int sum=0;
        double x1=0;
        while(i<N){
if (a[i][1]==0){
    /*int x1=((-(a [i][2]))\(a[i][0]));*/
    x1=-a[i][2]/a[i][0];
    if(xh>x1&&xu<x1){
        sum=sum+1;
    }else{
        if(xh<x1&&xu>x1){
            sum=sum+1;

        }
    }
}
else{
            double y1= ((-a[i][2]/(a[i][1]))+(-(a[i][0])*xh/(a[i][1])));
            double y2=((-a[i][2]/(a[i][1]))+(-(a[i][0])*xu/(a[i][1])));
            if (yh>y1&&yu<y2){
                sum=sum+1;
            }else{
                if(yh<y1&&yu>y2){
                    sum=sum+1;
                }

            }

        }
i++;

    }
        System.out.println(sum);

}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class CrazyTown {

  static BufferedReader in;
  static PrintWriter out;
  static StringTokenizer tok;

  static void solve() throws Exception {
    long x1 = nextLong(), y1 = nextLong();
    long x2 = nextLong(), y2 = nextLong();
    int n = nextInt();
    int ans = 0;
    while (n-- > 0) {
      long a = nextLong(), b = nextLong(), c = nextLong();
      long r1 = x1 * a + y1 * b + c;
      long r2 = x2 * a + y2 * b + c;
      if (r1 * r2 < 0)
        ans++;
    }
    out.println(ans);
  }

  public static void main(String args[]) {
    try {
      in = new BufferedReader(new InputStreamReader(System.in));
      out = new PrintWriter(new OutputStreamWriter(System.out));
      solve();
      in.close();
      out.close();
    } catch (Throwable e) {
      e.printStackTrace();
      System.exit(1);
    }
  }

  static int nextInt() throws IOException {
    return Integer.parseInt(next());
  }

  static int[] nextIntArray(int len, int start) throws IOException {
    int[] a = new int[len];
    for (int i = start; i < len; i++)
      a[i] = nextInt();
    return a;
  }

  static long nextLong() throws IOException {
    return Long.parseLong(next());
  }

  static long[] nextLongArray(int len, int start) throws IOException {
    long[] a = new long[len];
    for (int i = start; i < len; i++)
      a[i] = nextLong();
    return a;
  }

  static String next() throws IOException {
    while (tok == null || !tok.hasMoreTokens()) {
      tok = new StringTokenizer(in.readLine());
    }
    return tok.nextToken();
  }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class CrazyTown {

  static BufferedReader in;
  static PrintWriter out;
  static StringTokenizer tok;

  static void solve() throws Exception {
    long x1 = nextLong(), y1 = nextLong();
    long x2 = nextLong(), y2 = nextLong();
    int n = nextInt();
    int ans = 0;
    while (n-- > 0) {
      long a = nextLong(), b = nextLong(), c = nextLong();
      long r1 = x1 * a + y1 * b + c;
      long r2 = x2 * a + y2 * b + c;
      if ((r1 < 0 && r2 > 0) || (r1 > 0 && r2 < 0))
        ans++;
    }
    out.println(ans);
  }

  public static void main(String args[]) {
    try {
      in = new BufferedReader(new InputStreamReader(System.in));
      out = new PrintWriter(new OutputStreamWriter(System.out));
      solve();
      in.close();
      out.close();
    } catch (Throwable e) {
      e.printStackTrace();
      System.exit(1);
    }
  }

  static int nextInt() throws IOException {
    return Integer.parseInt(next());
  }

  static int[] nextIntArray(int len, int start) throws IOException {
    int[] a = new int[len];
    for (int i = start; i < len; i++)
      a[i] = nextInt();
    return a;
  }

  static long nextLong() throws IOException {
    return Long.parseLong(next());
  }

  static long[] nextLongArray(int len, int start) throws IOException {
    long[] a = new long[len];
    for (int i = start; i < len; i++)
      a[i] = nextLong();
    return a;
  }

  static String next() throws IOException {
    while (tok == null || !tok.hasMoreTokens()) {
      tok = new StringTokenizer(in.readLine());
    }
    return tok.nextToken();
  }

}


import java.util.Scanner;

public class CF284A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x1 = in.nextInt();
        int y1 = in.nextInt();

        int x2 = in.nextInt();
        int y2 = in.nextInt();

        int n = in.nextInt();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            long a = in.nextLong();
            long b = in.nextLong();
            long c = in.nextLong();
            long result = a * x1 + b * y1 - c;
            long result2 = a * x2 + b * y2 - c;
            if (result * result2 <= 0)
                ans++;
        }
        System.out.println(ans);
    }
}


import java.util.Scanner;

public class CF284A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x1 = in.nextInt();
        int y1 = in.nextInt();
        int x2 = in.nextInt();
        int y2 = in.nextInt();
        int n = in.nextInt();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            long a = in.nextLong();
            long b = in.nextLong();
            long c = in.nextLong();
            long x = -(a * x1 + b * y1);
            long y = -(a * x2 + b * y2);
            if ((x < c && y > c) || (x > c && y < c))
                ans++;
        }
        System.out.println(ans);
    }
}


import java.util.Scanner;

public class CF284A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x1 = in.nextInt();
        int y1 = in.nextInt();

        int x2 = in.nextInt();
        int y2 = in.nextInt();

        int n = in.nextInt();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            double a = in.nextDouble();
            double b = in.nextDouble();
            double c = in.nextDouble();
            double result = a * x1 + b * y1 - c;
            double result2 = a * x2 + b * y2 - c;
            if (result * result2 < 0)
                ans++;
        }
        System.out.println(ans);
    }
}


import java.util.Scanner;

public class CF284A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x1 = in.nextInt();
        int y1 = in.nextInt();
        int x2 = in.nextInt();
        int y2 = in.nextInt();
        int n = in.nextInt();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            long a = in.nextLong();
            long b = in.nextLong();
            long c = in.nextLong();
            long result = a * x1 + b * y1 + c;
            long result2 = a * x2 + b * y2 + c;
            if (Long.signum(result) * Long.signum(result2) < 0)
                ans++;
        }
        System.out.println(ans);
    }
}


import java.util.Scanner;

public class CF284A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x1 = in.nextInt();
        int y1 = in.nextInt();

        int x2 = in.nextInt();
        int y2 = in.nextInt();

        int n = in.nextInt();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            long a = in.nextLong();
            long b = in.nextLong();
            long c = in.nextLong();
            long result = a * x1 + b * y1 - c;
            long result2 = a * x2 + b * y2 - c;
            if (result * result2 < 0)
                ans++;
        }
        System.out.println(ans);
    }
}


import java.util.Scanner;

public class CF284A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int x1 = in.nextInt();
        int y1 = in.nextInt();

        int x2 = in.nextInt();
        int y2 = in.nextInt();

        int n = in.nextInt();
        int ans = 0;
        for (int i = 0; i < n; i++) {
            long a = in.nextLong();
            long b = in.nextLong();
            long c = in.nextLong();
            long result = a * x1 + b * y1 - c;
            long result2 = a * x2 + b * y2 - c;
            if(Long.signum(result) * Long.signum(result2) < 0)ans++;
        }
        System.out.println(ans);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class CrazyTown_CodeForces {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		String []temp = br.readLine().split(" ");
		long x1 = Long.parseLong(temp[0]);
		long y1 = Long.parseLong(temp[1]);
		temp = br.readLine().split(" ");
		long x2 = Long.parseLong(temp[0]);
		long y2 = Long.parseLong(temp[1]);
		int n = Integer.parseInt(br.readLine());
		int count=0;
		for(int i=0;i<n;i++){
			temp = br.readLine().split(" ");
			long a =Long.parseLong(temp[0]);
			long b =Long.parseLong(temp[1]);
			long c =Long.parseLong(temp[2]);
			double y11 = (double)((double)(-1*c-a*x1)/(double)b);
			double y22 = (double)((double)(-1*c-a*x2)/(double)b);
			if(y11-y1 < 0 && y22-y2 >0)
				count++;
			else
				if(y11-y1 > 0 && y22-y2 <0)
					count++;
		}

		out.println(count);
		out.flush();
		out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class CrazyTown_CodeForces {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		String []temp = br.readLine().split(" ");
		int x1 = Integer.parseInt(temp[0]);
		int y1 = Integer.parseInt(temp[1]);
		temp = br.readLine().split(" ");
		int x2 = Integer.parseInt(temp[0]);
		int y2 = Integer.parseInt(temp[1]);
		int n = Integer.parseInt(br.readLine());
		int count=0;
		for(int i=0;i<n;i++){
			temp = br.readLine().split(" ");
			int a =Integer.parseInt(temp[0]);
			int b =Integer.parseInt(temp[1]);
			int c =Integer.parseInt(temp[2]);
//			if(b==0){
//				if((x1>0 && x2<0 )||(x1<0 && x2>0))
//					count++;
//			}
	//		else{
				double y11 = (double)((double)(-1*c-a*x1)/(double)b);
				double y22 = (double)((double)(-1*c-a*x2)/(double)b);
				if(y11-y1 < 0 && y22-y2 >0)
					count++;
				else
					if(y11-y1 > 0 && y22-y2 <0)
						count++;
			}
	//	}
		out.println(count);
		out.flush();
		out.close();

	}

}


#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n, k;
bool is_clear = true;
void cl() {
    if (is_clear) return;
    cout << "R" << endl;
    is_clear = true;
}
bool inQ(int x) {
    is_clear = false;
    cout << "? " << x << endl;
    char resp;
    cin >> resp;
    return (resp == 'Y');
}
vector < int > get_unique(vector < int >& a, vector < int >& b) {
    if (a.empty()) return b;
    if (b.empty()) return a;
    assert(a.size() <= k && b.size() <= k);
    cl();
    for (int i = 0; i < a.size(); i++) {
        inQ(a[i]);
    }
    vector < bool > ok(b.size(), true);
    for (int i = 0; i < b.size(); i++) {
        if (inQ(b[i])) ok[i] = false;
    }
    cl();
    for (int i = a.size() - 1; i >= 0; i--) {
        inQ(a[i]);
    }
    for (int i = b.size() - 1; i >= 0; i--) {
        if (inQ(b[i])) ok[i] = false;
    }
    vector < int > tot = a;
    for (int i = 0; i < b.size(); i++) {
        if (ok[i]) tot.push_back(b[i]);
    }
    return tot;
}
vector < int > solve(int l, int r) {
    if (r - l + 1 == k) {
        vector < int > good;
        cl();
        for (int i = l; i <= r; i++) {
            if (!inQ(i)) good.push_back(i);
        }
        return good;
    }
    int mid = (l + r) / 2;
    auto a = solve(l, mid);
    auto b = solve(mid + 1, r);
    vector < vector < int > > allA, allB;
    map < int, int > sz;
    allA.resize((a.size() + k - 1) / k);
    allB.resize((b.size() + k - 1) / k);
    for (int i = 0; i * k < a.size(); i++) {
        int from = i * k;
        int to = min((int)a.size() - 1, from + k - 1);
        vector < int > hs_now;
        for (int j = from; j <= to; j++) hs_now.push_back(a[j]);
        allA.push_back(hs_now);
    }
    for (int i = 0; i * k < b.size(); i++) {
        int from = i * k;
        int to = min((int)b.size() - 1, from + k - 1);
        vector < int > hs_now;
        for (int j = from; j <= to; j++) hs_now.push_back(b[j]);
        allB.push_back(hs_now);
    }
    for (int i = 0; i < allA.size(); i++) {
        for (int j = 0; j < allB.size(); j++) {
            auto res = get_unique(allA[i], allB[j]);
            for (int p = allA[i].size(); p < res.size(); p++) {
                sz[res[p]]++;
            }
        }
    }
    vector < int > fin = a;
    for (int v : b) {
        if (sz[v] == allA.size()) fin.push_back(v);
    }
    return fin;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    cin >> n >> k;
    int gg = solve(1, n).size();
    cout << "! " << gg << endl;
    return 0;
}


#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n, k;
bool is_clear = true;
int qqqq = 0;
void cl() {
    if (is_clear) return;
    cout << "R" << endl;
    is_clear = true;
}
bool inQ(int x) {
    qqqq++;
    assert(qqqq <= (3 * n * n / (2 * k)));
    is_clear = false;
    cout << "? " << x << endl;
    char resp;
    cin >> resp;
    return (resp == 'Y');
}
vector < int > get_unique(vector < int >& a, vector < int >& b) {
    if (a.empty()) return b;
    if (b.empty()) return a;
    assert(a.size() <= k && b.size() <= k);
    cl();
    int to_add = 2 * k + 1 - a.size() - b.size();
    vector < bool > okA(a.size(), true);
    for (int i = 0; i < a.size(); i++) {
        inQ(a[i]);
    }
    vector < bool > okB(b.size(), true);
    for (int i = 0; i < b.size(); i++) {
        if (inQ(b[i])) okB[i] = false;
    }
    for (int j = 0; j < to_add; j++) inQ(a.back());
    for (int i = 0; i + 1 < a.size(); i++) {
        if (inQ(a[i])) okA[i] = false;
    }
    vector < int > tot = {};
    for (int i = 0; i < a.size(); i++) {
        if (okA[i]) tot.push_back(a[i]);
    }
    for (int i = 0; i < b.size(); i++) {
        if (okB[i]) tot.push_back(b[i]);
    }
    return tot;
}
vector < int > solve(int l, int r) {
    if (r - l + 1 == k) {
        vector < int > good;
        cl();
        for (int i = l; i <= r; i++) {
            if (!inQ(i)) good.push_back(i);
        }
        return good;
    }
    int mid = (l + r) / 2;
    auto a = solve(l, mid);
    auto b = solve(mid + 1, r);
    vector < vector < int > > allA, allB;
    map < int, int > sz;
    allA.resize((a.size() + k - 1) / k);
    allB.resize((b.size() + k - 1) / k);
    for (int i = 0; i * k < a.size(); i++) {
        int from = i * k;
        int to = min((int)a.size() - 1, from + k - 1);
        vector < int > hs_now;
        for (int j = from; j <= to; j++) hs_now.push_back(a[j]);
        allA.push_back(hs_now);
    }
    for (int i = 0; i * k < b.size(); i++) {
        int from = i * k;
        int to = min((int)b.size() - 1, from + k - 1);
        vector < int > hs_now;
        for (int j = from; j <= to; j++) hs_now.push_back(b[j]);
        allB.push_back(hs_now);
    }
    for (int i = 0; i < allA.size(); i++) {
        for (int j = 0; j < allB.size(); j++) {
            auto res = get_unique(allA[i], allB[j]);
            for (int p = allA[i].size(); p < res.size(); p++) {
                sz[res[p]]++;
            }
        }
    }
    vector < int > fin = a;
    for (int v : b) {
        if (sz[v] == allA.size()) fin.push_back(v);
    }
    return fin;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    //n = 1024;
    //k = 16;
    cin >> n >> k;
    int gg = solve(1, n).size();
    cout << "! " << gg << endl;
    return 0;
}


#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n, k;
bool is_clear = true;
void cl() {
    if (is_clear) return;
    cout << "R" << endl;
    is_clear = true;
}
bool inQ(int x) {
    is_clear = false;
    cout << "? " << x << endl;
    char resp;
    cin >> resp;
    return (resp == 'Y');
}
vector < int > get_unique(vector < int >& a, vector < int >& b) {
    if (a.empty()) return b;
    if (b.empty()) return a;
    assert(a.size() <= k && b.size() <= k);
    cl();
    int to_add = 2 * k + 1 - a.size() - b.size();
    vector < bool > okA(a.size(), true);
    for (int i = 0; i < a.size(); i++) {
        inQ(a[i]);
    }
    vector < bool > okB(b.size(), true);
    for (int i = 0; i < b.size(); i++) {
        if (inQ(b[i])) okB[i] = false;
    }
    for (int j = 0; j < to_add; j++) inQ(a.back());
    for (int i = 0; i < a.size(); i++) {
        if (inQ(a[i])) okA[i] = false;
    }
    vector < int > tot = {};
    for (int i = 0; i < a.size(); i++) {
        if (okA[i] || (i == a.size() - 1)) tot.push_back(a[i]);
    }
    for (int i = 0; i < b.size(); i++) {
        if (okB[i]) tot.push_back(b[i]);
    }
    return tot;
}
vector < int > solve(int l, int r) {
    if (r - l + 1 == k) {
        vector < int > good;
        cl();
        for (int i = l; i <= r; i++) {
            if (!inQ(i)) good.push_back(i);
        }
        return good;
    }
    int mid = (l + r) / 2;
    auto a = solve(l, mid);
    auto b = solve(mid + 1, r);
    vector < vector < int > > allA, allB;
    map < int, int > sz;
    allA.resize((a.size() + k - 1) / k);
    allB.resize((b.size() + k - 1) / k);
    for (int i = 0; i * k < a.size(); i++) {
        int from = i * k;
        int to = min((int)a.size() - 1, from + k - 1);
        vector < int > hs_now;
        for (int j = from; j <= to; j++) hs_now.push_back(a[j]);
        allA.push_back(hs_now);
    }
    for (int i = 0; i * k < b.size(); i++) {
        int from = i * k;
        int to = min((int)b.size() - 1, from + k - 1);
        vector < int > hs_now;
        for (int j = from; j <= to; j++) hs_now.push_back(b[j]);
        allB.push_back(hs_now);
    }
    for (int i = 0; i < allA.size(); i++) {
        for (int j = 0; j < allB.size(); j++) {
            auto res = get_unique(allA[i], allB[j]);
            for (int p = allA[i].size(); p < res.size(); p++) {
                sz[res[p]]++;
            }
        }
    }
    vector < int > fin = a;
    for (int v : b) {
        if (sz[v] == allA.size()) fin.push_back(v);
    }
    return fin;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    cin >> n >> k;
    int gg = solve(1, n).size();
    cout << "! " << gg << endl;
    return 0;
}


#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n, k;
bool is_clear = true;
int qqqq = 0;
void cl() {
    if (is_clear) return;
    cout << "R" << endl;
    is_clear = true;
}
bool inQ(int x) {
    qqqq++;
    assert(qqqq <= (3 * n * n / (2 * k)));
    is_clear = false;
    cout << "? " << x << endl;
    char resp;
    cin >> resp;
#ifdef DEBUG
    return false;
#endif
    return (resp == 'Y');
}
vector < int > get_unique(vector < int >& a, vector < int >& b) {
    if (a.empty()) return b;
    if (b.empty()) return a;
    assert(a.size() <= k && b.size() <= k);
    if (a.size() > b.size()) swap(a, b);
    cl();
    int to_add = 2 * k  - a.size() - b.size();
    vector < bool > okA(a.size(), true);
    for (int i = 0; i < a.size(); i++) {
        inQ(a[i]);
    }
    vector < bool > okB(b.size(), true);
    for (int i = 0; i < b.size(); i++) {
        if (inQ(b[i])) okB[i] = false;
    }
    for (int j = 0; j < to_add; j++) inQ(a.back());
    for (int i = 0; i + 1 < a.size(); i++) {
        if (inQ(a[i])) okA[i] = false;
    }
    vector < int > tot = {};
    for (int i = 0; i < a.size(); i++) {
        if (okA[i]) tot.push_back(a[i]);
    }
    for (int i = 0; i < b.size(); i++) {
        if (okB[i]) tot.push_back(b[i]);
    }
    return tot;
}
vector < int > solve(int l, int r) {
    if (r - l + 1 == k) {
        vector < int > good;
        cl();
        for (int i = l; i <= r; i++) {
            if (!inQ(i)) good.push_back(i);
        }
        return good;
    }
    int mid = (l + r) / 2;
    auto a = solve(l, mid);
    auto b = solve(mid + 1, r);
    vector < vector < int > > allA, allB;
    map < int, int > sz;
    allA.resize((a.size() + k - 1) / k);
    allB.resize((b.size() + k - 1) / k);
    for (int i = 0; i * k < a.size(); i++) {
        int from = i * k;
        int to = min((int)a.size() - 1, from + k - 1);
        vector < int > hs_now;
        for (int j = from; j <= to; j++) hs_now.push_back(a[j]);
        allA.push_back(hs_now);
    }
    for (int i = 0; i * k < b.size(); i++) {
        int from = i * k;
        int to = min((int)b.size() - 1, from + k - 1);
        vector < int > hs_now;
        for (int j = from; j <= to; j++) hs_now.push_back(b[j]);
        allB.push_back(hs_now);
    }
    for (int i = 0; i < allA.size(); i++) {
        for (int j = 0; j < allB.size(); j++) {
            auto res = get_unique(allA[i], allB[j]);
            for (int p = allA[i].size(); p < res.size(); p++) {
                sz[res[p]]++;
            }
        }
    }
    vector < int > fin = a;
    for (int v : b) {
        if (sz[v] == allA.size()) fin.push_back(v);
    }
    return fin;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    //n = 1024;
    //k = 16;
    cin >> n >> k;
    int gg = solve(1, n).size();
    cout << "! " << gg << endl;
    return 0;
}


#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n, k;
bool is_clear = true;
int qqqq = 0;
void cl() {
    if (is_clear) return;
    cout << "R" << endl;
    is_clear = true;
}
bool inQ(int x) {
    qqqq++;
    assert(qqqq <= 15000);
    is_clear = false;
    cout << "? " << x << endl;
    char resp;
    cin >> resp;
    return (resp == 'Y');
}
vector < int > get_unique(vector < int >& a, vector < int >& b) {
    if (a.empty()) return b;
    if (b.empty()) return a;
    assert(a.size() <= k && b.size() <= k);
    if (a.size() > b.size()) swap(a, b);
    if (k == 1) {
        cl();
        inQ(a[0]);
        if (inQ(b[0])) return {a[0]};
        else return {a[0], b[0]};
    }
    cl();
    int to_add = 2 * k + 1 - a.size() - b.size();
    vector < bool > okA(a.size(), true);
    for (int i = 0; i < a.size(); i++) {
        inQ(a[i]);
    }
    vector < bool > okB(b.size(), true);
    for (int i = 0; i < b.size(); i++) {
        if (inQ(b[i])) okB[i] = false;
    }
    for (int j = 0; j < to_add; j++) inQ(a.back());
    for (int i = 0; i < a.size(); i++) {
        if (inQ(a[i])) okA[i] = false;
    }
    vector < int > tot = {};
    for (int i = 0; i < a.size(); i++) {
        if (okA[i] || (i == a.size() - 1)) tot.push_back(a[i]);
    }
    for (int i = 0; i < b.size(); i++) {
        if (okB[i]) tot.push_back(b[i]);
    }
    return tot;
}
vector < int > solve(int l, int r) {
    if (r - l + 1 == k) {
        vector < int > good;
        cl();
        for (int i = l; i <= r; i++) {
            if (!inQ(i)) good.push_back(i);
        }
        return good;
    }
    int mid = (l + r) / 2;
    auto a = solve(l, mid);
    auto b = solve(mid + 1, r);
    vector < vector < int > > allA, allB;
    map < int, int > sz;
    allA.resize((a.size() + k - 1) / k);
    allB.resize((b.size() + k - 1) / k);
    for (int i = 0; i * k < a.size(); i++) {
        int from = i * k;
        int to = min((int)a.size() - 1, from + k - 1);
        vector < int > hs_now;
        for (int j = from; j <= to; j++) hs_now.push_back(a[j]);
        allA.push_back(hs_now);
    }
    for (int i = 0; i * k < b.size(); i++) {
        int from = i * k;
        int to = min((int)b.size() - 1, from + k - 1);
        vector < int > hs_now;
        for (int j = from; j <= to; j++) hs_now.push_back(b[j]);
        allB.push_back(hs_now);
    }
    for (int i = 0; i < allA.size(); i++) {
        for (int j = 0; j < allB.size(); j++) {
            auto res = get_unique(allA[i], allB[j]);
            for (int p = allA[i].size(); p < res.size(); p++) {
                sz[res[p]]++;
            }
        }
    }
    vector < int > fin = a;
    for (int v : b) {
        if (sz[v] == allA.size()) fin.push_back(v);
    }
    return fin;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    cin >> n >> k;
    int gg = solve(1, n).size();
    cout << "! " << gg << endl;
    return 0;
}


#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int n, k;
bool is_clear = true;
void cl() {
    if (is_clear) return;
    cout << "R" << endl;
    is_clear = true;
}
bool inQ(int x) {
    is_clear = false;
    cout << "? " << x << endl;
    char resp;
    cin >> resp;
    return (resp == 'Y');
}
vector < int > get_unique(vector < int >& a, vector < int >& b) {
    if (a.empty()) return b;
    if (b.empty()) return a;
    assert(a.size() <= k && b.size() <= k);
    cl();
    int to_add = 2 * k + 1 - a.size() - b.size();
    vector < bool > okA(a.size(), true);
    for (int i = 0; i < a.size(); i++) {
        inQ(a[i]);
    }
    vector < bool > okB(b.size(), true);
    for (int i = 0; i < b.size(); i++) {
        if (inQ(b[i])) okB[i] = false;
    }
    for (int j = 0; j < to_add; j++) inQ(a[0]);
    for (int i = 0; i < a.size(); i++) {
        if (inQ(a[i])) okA[i] = false;
    }
    vector < int > tot = {};
    for (int i = 0; i < a.size(); i++) {
        if (okA[i]) tot.push_back(a[i]);
    }
    for (int i = 0; i < b.size(); i++) {
        if (okB[i]) tot.push_back(b[i]);
    }
    return tot;
}
vector < int > solve(int l, int r) {
    if (r - l + 1 == k) {
        vector < int > good;
        cl();
        for (int i = l; i <= r; i++) {
            if (!inQ(i)) good.push_back(i);
        }
        return good;
    }
    int mid = (l + r) / 2;
    auto a = solve(l, mid);
    auto b = solve(mid + 1, r);
    vector < vector < int > > allA, allB;
    map < int, int > sz;
    allA.resize((a.size() + k - 1) / k);
    allB.resize((b.size() + k - 1) / k);
    for (int i = 0; i * k < a.size(); i++) {
        int from = i * k;
        int to = min((int)a.size() - 1, from + k - 1);
        vector < int > hs_now;
        for (int j = from; j <= to; j++) hs_now.push_back(a[j]);
        allA.push_back(hs_now);
    }
    for (int i = 0; i * k < b.size(); i++) {
        int from = i * k;
        int to = min((int)b.size() - 1, from + k - 1);
        vector < int > hs_now;
        for (int j = from; j <= to; j++) hs_now.push_back(b[j]);
        allB.push_back(hs_now);
    }
    for (int i = 0; i < allA.size(); i++) {
        for (int j = 0; j < allB.size(); j++) {
            auto res = get_unique(allA[i], allB[j]);
            for (int p = allA[i].size(); p < res.size(); p++) {
                sz[res[p]]++;
            }
        }
    }
    vector < int > fin = a;
    for (int v : b) {
        if (sz[v] == allA.size()) fin.push_back(v);
    }
    return fin;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    //freopen("input.txt", "r", stdin);
    cin >> n >> k;
    int gg = solve(1, n).size();
    cout << "! " << gg << endl;
    return 0;
}


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

// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; })

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;

using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace __input {
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
        re(first); re(rest...);
    }

    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}
using namespace __input;

namespace __output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const deque<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
        pr(first); pr(rest...);
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) {
        pr("{",x.f,", ",x.s,"}");
    }
    template<class T, bool pretty = true> void prContain(const T& x) {
        if (pretty) pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?pretty?", ":" ":"",a), fst = 0;
        if (pretty) pr("}");
    }
    template<class T> void pc(const T& x) { prContain<T, false>(x); pr("\n"); }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const deque<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) {
        pr(first); ps();
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
        pr(first," "); ps(rest...);
    }
}
using namespace __output;

#define TRACE(x) x
#define __pn(x) pr(#x, " = ")
#define pd(...) __pn((__VA_ARGS__)), ps(__VA_ARGS__), cout << flush

namespace __algorithm {
    template<typename T> void dedup(vector<T>& v) {
        sort(all(v)); v.erase(unique(all(v)), v.end());
    }
    template<typename T> typename vector<T>::iterator find(vector<T>& v, const T& x) {
        auto it = lower_bound(all(v), x); return it != v.end() && *it == x ? it : v.end();
    }
    template<typename T> size_t index(vector<T>& v, const T& x) {
        auto it = find(v, x); assert(it != v.end() && *it == x); return it - v.begin();
    }
    template<typename C, typename T, typename OP> vector<T> prefixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0R (i, sz(v)) r[i+1] = op(r[i], v[i]); return r;
    }
    template<typename C, typename T, typename OP> vector<T> suffixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0Rd (i, sz(v)) r[i] = op(v[i], r[i+1]); return r;
    }
}
using namespace __algorithm;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
struct monostate {
    friend istream& operator>>(istream& is, const monostate& ms) { return is; }
    friend ostream& operator<<(ostream& os, const monostate& ms) { return os; }
    friend monostate operator+(const monostate& a, const monostate& b) { return a; }
} ms;
#pragma GCC diagnostic pop

namespace __io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0);
        cout << fixed << setprecision(15);
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
    }
}
using namespace __io;
// }}}

bool taste(int loc) {
    cout << "? " << loc + 1 << endl;
    char r; re(r);
    if (r == 'E') assert(0);
    return r == 'Y';
}

void clear() {
    cout << "R" << endl;
}

void finish(vi ans) {
    cout << "! " << sz(ans) << endl;
}

vi solve(int L, int R, int K) {
    if (R - L == K) {
        vi res;
        clear();
        FOR (loc, L, R) if (taste(loc)) res.pb(loc);
        return res;
    }
    assert(R - L > K);

    vi left  = solve(L, (L + R) / 2, K),
       right = solve((L + R) / 2, R, K);

    vi res = left;

    for (int i = 0; i < sz(right); i += K/2) {
        vb should(K / 2, 1);

        for (int j = 0; j < sz(left); j += K/2) {
            clear();
            FOR (k, j, min(sz(left), j + K/2)) {
                taste(left[k]);
            }
            FOR (k, i, min(sz(right), i + K/2)) {
                should[k - i] = should[k - i] & taste(right[k]);
            }
        }

        FOR (k, i, min(sz(right), i + K/2))
            if (should[k - i])
                res.pb(right[k]);
    }

    return res;
}

int main() {
    setIO();

    int N, K; re(N, K);

    if (K == 1) { // n^2 <= 10,000
        vi ans = {0};
        FOR (loc, 1, N) {
            bool add = 1;
            trav (e, ans) {
                clear();
                taste(e);
                add &= taste(loc);
            }
            if (add) ans.pb(loc);
        }
        finish(ans);
    } else {
        finish(solve(0, N, K));
    }

    // did you check N=1? did you mix up N,M?
    // check your "infinity" and "null" values against the bounds
    return 0;
}


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

// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; })

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;

using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace __input {
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
        re(first); re(rest...);
    }

    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}
using namespace __input;

namespace __output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const deque<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
        pr(first); pr(rest...);
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) {
        pr("{",x.f,", ",x.s,"}");
    }
    template<class T, bool pretty = true> void prContain(const T& x) {
        if (pretty) pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?pretty?", ":" ":"",a), fst = 0;
        if (pretty) pr("}");
    }
    template<class T> void pc(const T& x) { prContain<T, false>(x); pr("\n"); }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const deque<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) {
        pr(first); ps();
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
        pr(first," "); ps(rest...);
    }
}
using namespace __output;

#define TRACE(x) x
#define __pn(x) pr(#x, " = ")
#define pd(...) __pn((__VA_ARGS__)), ps(__VA_ARGS__), cout << flush

namespace __algorithm {
    template<typename T> void dedup(vector<T>& v) {
        sort(all(v)); v.erase(unique(all(v)), v.end());
    }
    template<typename T> typename vector<T>::iterator find(vector<T>& v, const T& x) {
        auto it = lower_bound(all(v), x); return it != v.end() && *it == x ? it : v.end();
    }
    template<typename T> size_t index(vector<T>& v, const T& x) {
        auto it = find(v, x); assert(it != v.end() && *it == x); return it - v.begin();
    }
    template<typename C, typename T, typename OP> vector<T> prefixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0R (i, sz(v)) r[i+1] = op(r[i], v[i]); return r;
    }
    template<typename C, typename T, typename OP> vector<T> suffixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0Rd (i, sz(v)) r[i] = op(v[i], r[i+1]); return r;
    }
}
using namespace __algorithm;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
struct monostate {
    friend istream& operator>>(istream& is, const monostate& ms) { return is; }
    friend ostream& operator<<(ostream& os, const monostate& ms) { return os; }
    friend monostate operator+(const monostate& a, const monostate& b) { return a; }
} ms;
#pragma GCC diagnostic pop

namespace __io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0);
        cout << fixed << setprecision(15);
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
    }
}
using namespace __io;
// }}}

bool taste(int loc) {
    cout << "? " << loc + 1 << endl;
    char r; re(r);
    if (r == 'E') assert(0);
    return r != 'Y';
}

void clear() {
    cout << "R" << endl;
}

void finish(vi ans) {
    cout << "! " << sz(ans) << endl;
}

int main() {
    setIO();

    int N, K; re(N, K);

    int SZ = max(K/2, 1);
    int M = N / SZ;

    vi ct(N, 1);

    FOR (j, 1, M) {
        F0R (res, j) if (res + j < M) {
            clear();
            for (int i = res; i < M; i += j) {
                F0R (k, SZ) ct[i * SZ + k] &= taste(i * SZ + k);
            }
        }
    }

    ps(accumulate(all(ct), 0));

    // did you check N=1? did you mix up N,M?
    // check your "infinity" and "null" values against the bounds
    return 0;
}


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

// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; })

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;

using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace __input {
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
        re(first); re(rest...);
    }

    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}
using namespace __input;

namespace __output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const deque<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
        pr(first); pr(rest...);
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) {
        pr("{",x.f,", ",x.s,"}");
    }
    template<class T, bool pretty = true> void prContain(const T& x) {
        if (pretty) pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?pretty?", ":" ":"",a), fst = 0;
        if (pretty) pr("}");
    }
    template<class T> void pc(const T& x) { prContain<T, false>(x); pr("\n"); }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const deque<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) {
        pr(first); ps();
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
        pr(first," "); ps(rest...);
    }
}
using namespace __output;

#define TRACE(x) x
#define __pn(x) pr(#x, " = ")
#define pd(...) __pn((__VA_ARGS__)), ps(__VA_ARGS__), cout << flush

namespace __algorithm {
    template<typename T> void dedup(vector<T>& v) {
        sort(all(v)); v.erase(unique(all(v)), v.end());
    }
    template<typename T> typename vector<T>::iterator find(vector<T>& v, const T& x) {
        auto it = lower_bound(all(v), x); return it != v.end() && *it == x ? it : v.end();
    }
    template<typename T> size_t index(vector<T>& v, const T& x) {
        auto it = find(v, x); assert(it != v.end() && *it == x); return it - v.begin();
    }
    template<typename C, typename T, typename OP> vector<T> prefixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0R (i, sz(v)) r[i+1] = op(r[i], v[i]); return r;
    }
    template<typename C, typename T, typename OP> vector<T> suffixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0Rd (i, sz(v)) r[i] = op(v[i], r[i+1]); return r;
    }
}
using namespace __algorithm;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
struct monostate {
    friend istream& operator>>(istream& is, const monostate& ms) { return is; }
    friend ostream& operator<<(ostream& os, const monostate& ms) { return os; }
    friend monostate operator+(const monostate& a, const monostate& b) { return a; }
} ms;
#pragma GCC diagnostic pop

namespace __io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0);
        cout << fixed << setprecision(15);
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
    }
}
using namespace __io;
// }}}

bool taste(int loc) {
    ps("?", loc + 1);
    cout << flush;
    char r; re(r); return r == 'Y';
}

void clear() {
    ps("R");
    cout << flush;
}

void finish(vi ans) {
    ps("!", sz(ans));
    cout << flush;
}

vi solve(int L, int R, int K) {
    if (R - L == K) {
        vi res;
        clear();
        FOR (loc, L, R) if (taste(loc)) res.pb(loc);
        return res;
    }
    assert(R - L > K);

    vi left  = solve(L, (L + R) / 2, K),
       right = solve((L + R) / 2, R, K);

    vi res = left;

    for (int i = 0; i < sz(right); i += K/2) {
        vb should(K / 2, 1);

        for (int j = 0; j < sz(left); j += K/2) {
            clear();
            FOR (k, j, min(sz(left), j + K/2)) {
                taste(left[k]);
            }
            FOR (k, i, min(sz(right), i + K/2)) {
                should[k] = should[k] & taste(right[k]);
            }
        }

        FOR (k, i, min(sz(right), i + K/2))
            if (should[k])
                res.pb(right[k]);
    }

    return res;
}

int main() {
    setIO();

    int N, K; re(N, K);

    if (K == 1) { // n^2 <= 10,000
        vi ans = {0};
        FOR (loc, 1, N) {
            bool add = 1;
            trav (e, ans) {
                clear();
                taste(e);
                add &= taste(loc);
            }
            if (add) ans.pb(loc);
        }
        finish(ans);
    } else {
        finish(solve(0, N, K));
    }

    // did you check N=1? did you mix up N,M?
    // check your "infinity" and "null" values against the bounds
    return 0;
}


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

// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; })

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;

using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace __input {
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
        re(first); re(rest...);
    }

    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}
using namespace __input;

namespace __output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const deque<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
        pr(first); pr(rest...);
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) {
        pr("{",x.f,", ",x.s,"}");
    }
    template<class T, bool pretty = true> void prContain(const T& x) {
        if (pretty) pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?pretty?", ":" ":"",a), fst = 0;
        if (pretty) pr("}");
    }
    template<class T> void pc(const T& x) { prContain<T, false>(x); pr("\n"); }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const deque<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) {
        pr(first); ps();
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
        pr(first," "); ps(rest...);
    }
}
using namespace __output;

#define TRACE(x) x
#define __pn(x) pr(#x, " = ")
#define pd(...) __pn((__VA_ARGS__)), ps(__VA_ARGS__), cout << flush

namespace __algorithm {
    template<typename T> void dedup(vector<T>& v) {
        sort(all(v)); v.erase(unique(all(v)), v.end());
    }
    template<typename T> typename vector<T>::iterator find(vector<T>& v, const T& x) {
        auto it = lower_bound(all(v), x); return it != v.end() && *it == x ? it : v.end();
    }
    template<typename T> size_t index(vector<T>& v, const T& x) {
        auto it = find(v, x); assert(it != v.end() && *it == x); return it - v.begin();
    }
    template<typename C, typename T, typename OP> vector<T> prefixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0R (i, sz(v)) r[i+1] = op(r[i], v[i]); return r;
    }
    template<typename C, typename T, typename OP> vector<T> suffixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0Rd (i, sz(v)) r[i] = op(v[i], r[i+1]); return r;
    }
}
using namespace __algorithm;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
struct monostate {
    friend istream& operator>>(istream& is, const monostate& ms) { return is; }
    friend ostream& operator<<(ostream& os, const monostate& ms) { return os; }
    friend monostate operator+(const monostate& a, const monostate& b) { return a; }
} ms;
#pragma GCC diagnostic pop

namespace __io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0);
        cout << fixed << setprecision(15);
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
    }
}
using namespace __io;
// }}}

bool taste(int loc) {
    cout << "? " << loc + 1 << endl;
    char r; re(r);
    if (r == 'E') assert(0);
    return r == 'Y';
}

void clear() {
    cout << "R" << endl;
}

void finish(vi ans) {
    cout << "! " << sz(ans) << endl;
}

vi solve(int L, int R, int K) {
    if (R - L == K) {
        vi res;
        clear();
        FOR (loc, L, R) if (taste(loc)) res.pb(loc);
        return res;
    }
    assert(R - L > K);

    vi left  = solve(L, (L + R) / 2, K),
       right = solve((L + R) / 2, R, K);

    vi res = left;

    for (int i = 0; i < sz(right); i += K/2) {
        vb should(K / 2, 1);

        for (int j = 0; j < sz(left); j += K/2) {
            clear();
            FOR (k, j, min(sz(left), j + K/2)) {
                taste(left[k]);
            }
            FOR (k, i, min(sz(right), i + K/2)) {
                should[k] = should[k] & taste(right[k]);
            }
        }

        FOR (k, i, min(sz(right), i + K/2))
            if (should[k])
                res.pb(right[k]);
    }

    return res;
}

int main() {
    setIO();

    int N, K; re(N, K);

    if (K == 1) { // n^2 <= 10,000
        vi ans = {0};
        FOR (loc, 1, N) {
            bool add = 1;
            trav (e, ans) {
                clear();
                taste(e);
                add &= taste(loc);
            }
            if (add) ans.pb(loc);
        }
        finish(ans);
    } else {
        finish(solve(0, N, K));
    }

    // did you check N=1? did you mix up N,M?
    // check your "infinity" and "null" values against the bounds
    return 0;
}


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

// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; })

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;

using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace __input {
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
        re(first); re(rest...);
    }

    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}
using namespace __input;

namespace __output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const deque<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
        pr(first); pr(rest...);
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) {
        pr("{",x.f,", ",x.s,"}");
    }
    template<class T, bool pretty = true> void prContain(const T& x) {
        if (pretty) pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?pretty?", ":" ":"",a), fst = 0;
        if (pretty) pr("}");
    }
    template<class T> void pc(const T& x) { prContain<T, false>(x); pr("\n"); }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const deque<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) {
        pr(first); ps();
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
        pr(first," "); ps(rest...);
    }
}
using namespace __output;

#define TRACE(x) x
#define __pn(x) pr(#x, " = ")
#define pd(...) __pn((__VA_ARGS__)), ps(__VA_ARGS__), cout << flush

namespace __algorithm {
    template<typename T> void dedup(vector<T>& v) {
        sort(all(v)); v.erase(unique(all(v)), v.end());
    }
    template<typename T> typename vector<T>::iterator find(vector<T>& v, const T& x) {
        auto it = lower_bound(all(v), x); return it != v.end() && *it == x ? it : v.end();
    }
    template<typename T> size_t index(vector<T>& v, const T& x) {
        auto it = find(v, x); assert(it != v.end() && *it == x); return it - v.begin();
    }
    template<typename C, typename T, typename OP> vector<T> prefixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0R (i, sz(v)) r[i+1] = op(r[i], v[i]); return r;
    }
    template<typename C, typename T, typename OP> vector<T> suffixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0Rd (i, sz(v)) r[i] = op(v[i], r[i+1]); return r;
    }
}
using namespace __algorithm;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
struct monostate {
    friend istream& operator>>(istream& is, const monostate& ms) { return is; }
    friend ostream& operator<<(ostream& os, const monostate& ms) { return os; }
    friend monostate operator+(const monostate& a, const monostate& b) { return a; }
} ms;
#pragma GCC diagnostic pop

namespace __io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0);
        cout << fixed << setprecision(15);
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
    }
}
using namespace __io;
// }}}

bool taste(int loc) {
    cout << "? " << loc + 1 << endl;
    char r; re(r);
    if (r == 'E') assert(0);
    return r != 'Y';
}

void clear() {
    cout << "R" << endl;
}

void finish(vi ans) {
    cout << "! " << sz(ans) << endl;
}

vi solve(int L, int R, int K) {
    if (R - L == K) {
        vi res;
        clear();
        FOR (loc, L, R) if (taste(loc)) res.pb(loc);
        return res;
    }
    assert(R - L > K);

    vi left  = solve(L, (L + R) / 2, K),
       right = solve((L + R) / 2, R, K);

    vi res = left;

    for (int i = 0; i < sz(right); i += K/2) {
        vb should(K / 2, 1);

        for (int j = 0; j < sz(left); j += K/2) {
            clear();
            FOR (k, j, min(sz(left), j + K/2)) {
                taste(left[k]);
            }
            FOR (k, i, min(sz(right), i + K/2)) {
                should[k - i] = should[k - i] & taste(right[k]);
            }
        }

        FOR (k, i, min(sz(right), i + K/2))
            if (should[k - i])
                res.pb(right[k]);
    }

    return res;
}

int main() {
    setIO();

    int N, K; re(N, K);

    if (K == 1) { // n^2 <= 10,000
        vi ans = {0};
        FOR (loc, 1, N) {
            bool add = 1;
            trav (e, ans) {
                clear();
                taste(e);
                add &= taste(loc);
            }
            if (add) ans.pb(loc);
        }
        finish(ans);
    } else {
        finish(solve(0, N, K));
    }

    // did you check N=1? did you mix up N,M?
    // check your "infinity" and "null" values against the bounds
    return 0;
}


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

// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; })

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;

using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace __input {
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
        re(first); re(rest...);
    }

    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}
using namespace __input;

namespace __output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const deque<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
        pr(first); pr(rest...);
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) {
        pr("{",x.f,", ",x.s,"}");
    }
    template<class T, bool pretty = true> void prContain(const T& x) {
        if (pretty) pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?pretty?", ":" ":"",a), fst = 0;
        if (pretty) pr("}");
    }
    template<class T> void pc(const T& x) { prContain<T, false>(x); pr("\n"); }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const deque<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) {
        pr(first); ps();
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
        pr(first," "); ps(rest...);
    }
}
using namespace __output;

#define TRACE(x) x
#define __pn(x) pr(#x, " = ")
#define pd(...) __pn((__VA_ARGS__)), ps(__VA_ARGS__), cout << flush

namespace __algorithm {
    template<typename T> void dedup(vector<T>& v) {
        sort(all(v)); v.erase(unique(all(v)), v.end());
    }
    template<typename T> typename vector<T>::iterator find(vector<T>& v, const T& x) {
        auto it = lower_bound(all(v), x); return it != v.end() && *it == x ? it : v.end();
    }
    template<typename T> size_t index(vector<T>& v, const T& x) {
        auto it = find(v, x); assert(it != v.end() && *it == x); return it - v.begin();
    }
    template<typename C, typename T, typename OP> vector<T> prefixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0R (i, sz(v)) r[i+1] = op(r[i], v[i]); return r;
    }
    template<typename C, typename T, typename OP> vector<T> suffixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0Rd (i, sz(v)) r[i] = op(v[i], r[i+1]); return r;
    }
}
using namespace __algorithm;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
struct monostate {
    friend istream& operator>>(istream& is, const monostate& ms) { return is; }
    friend ostream& operator<<(ostream& os, const monostate& ms) { return os; }
    friend monostate operator+(const monostate& a, const monostate& b) { return a; }
} ms;
#pragma GCC diagnostic pop

namespace __io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0);
        cout << fixed << setprecision(15);
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
    }
}
using namespace __io;
// }}}

bool taste(int loc) {
    cout << "? " << loc + 1 << endl;
    char r; re(r);
    if (r == 'E') assert(0);
    return r == 'Y';
}

void clear() {
    cout << "R" << endl;
}

void finish(vi ans) {
    cout << "! " << sz(ans) << endl;
}

vi solve(int L, int R, int K) {
    if (R - L == K) {
        vi res;
        clear();
        FOR (loc, L, R) if (taste(loc)) res.pb(loc);
        return res;
    }
    assert(R - L > K);

    vi left  = solve(L, (L + R) / 2, K),
       right = solve((L + R) / 2, R, K);

    vi res = left;

    for (int i = 0; i < sz(right); i += K/2) {
        vb should(K / 2, 1);

        for (int j = 0; j < sz(left); j += K/2) {
            clear();
            FOR (k, j, min(sz(left), j + K/2)) {
                taste(left[k]);
            }
            FOR (k, i, min(sz(right), i + K/2)) {
                should[k - i] = should[k] & taste(right[k]);
            }
        }

        FOR (k, i, min(sz(right), i + K/2))
            if (should[k - i])
                res.pb(right[k]);
    }

    return res;
}

int main() {
    setIO();

    int N, K; re(N, K);

    if (K == 1) { // n^2 <= 10,000
        vi ans = {0};
        FOR (loc, 1, N) {
            bool add = 1;
            trav (e, ans) {
                clear();
                taste(e);
                add &= taste(loc);
            }
            if (add) ans.pb(loc);
        }
        finish(ans);
    } else {
        finish(solve(0, N, K));
    }

    // did you check N=1? did you mix up N,M?
    // check your "infinity" and "null" values against the bounds
    return 0;
}


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

// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define sort_by(x, y) sort(all(x), [&](const auto& a, const auto& b) { return y; })

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;

using vpii = vector<pii>;
using vvpii = vector<vpii>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
using vpdd = vector<pdd>;
using vvpdd = vector<vpdd>;

template<typename T> void ckmin(T& a, const T& b) { a = min(a, b); }
template<typename T> void ckmax(T& a, const T& b) { a = max(a, b); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

namespace __input {
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
        re(first); re(rest...);
    }

    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}
using namespace __input;

namespace __output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const deque<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
        pr(first); pr(rest...);
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) {
        pr("{",x.f,", ",x.s,"}");
    }
    template<class T, bool pretty = true> void prContain(const T& x) {
        if (pretty) pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?pretty?", ":" ":"",a), fst = 0;
        if (pretty) pr("}");
    }
    template<class T> void pc(const T& x) { prContain<T, false>(x); pr("\n"); }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const deque<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) {
        pr(first); ps();
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
        pr(first," "); ps(rest...);
    }
}
using namespace __output;

#define TRACE(x) x
#define __pn(x) pr(#x, " = ")
#define pd(...) __pn((__VA_ARGS__)), ps(__VA_ARGS__), cout << flush

namespace __algorithm {
    template<typename T> void dedup(vector<T>& v) {
        sort(all(v)); v.erase(unique(all(v)), v.end());
    }
    template<typename T> typename vector<T>::iterator find(vector<T>& v, const T& x) {
        auto it = lower_bound(all(v), x); return it != v.end() && *it == x ? it : v.end();
    }
    template<typename T> size_t index(vector<T>& v, const T& x) {
        auto it = find(v, x); assert(it != v.end() && *it == x); return it - v.begin();
    }
    template<typename C, typename T, typename OP> vector<T> prefixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0R (i, sz(v)) r[i+1] = op(r[i], v[i]); return r;
    }
    template<typename C, typename T, typename OP> vector<T> suffixes(const C& v, T id, OP op) {
        vector<T> r(sz(v)+1, id); F0Rd (i, sz(v)) r[i] = op(v[i], r[i+1]); return r;
    }
}
using namespace __algorithm;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
struct monostate {
    friend istream& operator>>(istream& is, const monostate& ms) { return is; }
    friend ostream& operator<<(ostream& os, const monostate& ms) { return os; }
    friend monostate operator+(const monostate& a, const monostate& b) { return a; }
} ms;
#pragma GCC diagnostic pop

namespace __io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0);
        cout << fixed << setprecision(15);
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); }
    }
}
using namespace __io;
// }}}

bool taste(int loc) {
    cout << "? " << loc + 1 << endl;
    char r; re(r);
    if (r == 'E') assert(0);
    return r != 'Y';
}

int main() {
    setIO();

    int N, K; re(N, K);

    int SZ = max(K/2, 1);
    int M = N / SZ;

    vi ct(N, 1);

    FOR (j, 1, M) {
        F0R (res, j) if (res + j < M) {
            cout << "R" << endl;
            for (int i = res; i < M; i += j) {
                F0R (k, SZ) ct[i * SZ + k] &= taste(i * SZ + k);
            }
        }
    }

    cout << "! " << accumulate(all(ct), 0) << endl;

    // did you check N=1? did you mix up N,M?
    // check your "infinity" and "null" values against the bounds
    return 0;
}