This is the easy version of the problem. The difference between the versions is that the easy version does not require you to output the numbers of the rods to be removed. You can make hacks only if all versions of the problem are solved.

Stitch likes experimenting with different machines with his friend Sparky. Today they built another machine.

The main element of this machine are n rods arranged along one straight line and numbered from 1 to n inclusive. Each of these rods must carry an electric charge quantitatively equal to either 1 or -1 (otherwise the machine will not work). Another condition for this machine to work is that the sign-variable sum of the charge on all rods must be zero.

More formally, the rods can be represented as an array of n numbers characterizing the charge: either 1 or -1. Then the condition must hold: a_1 - a_2 + a_3 - a_4 + … = 0, or ∑_{i=1}^n (-1)^{i-1} ⋅ a_i = 0.

Sparky charged all n rods with an electric current, but unfortunately it happened that the rods were not charged correctly (the sign-variable sum of the charge is not zero). The friends decided to leave only some of the rods in the machine. Sparky has q questions. In the ith question Sparky asks: if the machine consisted only of rods with numbers l_i to r_i inclusive, what minimal number of rods could be removed from the machine so that the sign-variable sum of charges on the remaining ones would be zero? Perhaps the friends got something wrong, and the sign-variable sum is already zero. In that case, you don't have to remove the rods at all.

If the number of rods is zero, we will assume that the sign-variable sum of charges is zero, that is, we can always remove all rods.

Help your friends and answer all of Sparky's questions!

Input

Each test contains multiple test cases.

The first line contains one positive integer t (1 ≤ t ≤ 10^3), denoting the number of test cases. Description of the test cases follows.

The first line of each test case contains two positive integers n and q (1 ≤ n, q ≤ 3 ⋅ 10^5) — the number of rods and the number of questions.

The second line of each test case contains a non-empty string s of length n, where the charge of the i-th rod is 1 if s_i is the "+" symbol, or -1 if s_i is the "-" symbol.

Each next line from the next q lines contains two positive integers l_i ans r_i (1 ≤ l_i ≤ r_i ≤ n) — numbers, describing Sparky's questions.

It is guaranteed that the sum of n over all test cases does not exceed 3 ⋅ 10^5, and the sum of q over all test cases does not exceed 3 ⋅ 10^5.

Output

For each test case, print a single integer — the minimal number of rods that can be removed.

Example

Input


3
14 1
+--++---++-++-
1 14
14 3
+--++---+++---
1 14
6 12
3 10
4 10
+-+-
1 1
1 2
1 3
1 4
2 2
2 3
2 4
3 3
3 4
4 4


Output


2
2
1
0
1
2
1
2
1
2
1
1
2
1

Note

In the first test case for the first query you can remove the rods numbered 5 and 8, then the following set of rods will remain: +--+--++-++-. It is easy to see that here the sign-variable sum is zero.

In the second test case:

  * For the first query, we can remove the rods numbered 1 and 11, then the following set of rods will remain: --++---++---. It is easy to see that here the sign-variable sum is zero. 
  * For the second query we can remove the rod numbered 9, then the following set of rods will remain: ---++-. It is easy to see that here the variable sum is zero. 
  * For the third query we can not remove the rods at all. 
import java.io.*;
import java.util.*;
 
public class Practice
{
	static int mod=1000000007;
	static HashSet<Integer> pr;
	static FastReader sc=new FastReader(System.in);
//	static Reader sc=new Reader();
	static  PrintWriter out=new PrintWriter(System.out);
	public static void main(String[] args) throws IOException
	{ 
		int t=1;
		t=sc.nextInt();
//		StringBuilder sb=new StringBuilder();
		while(t-->0)
		{
			solve();
//			sb.append("\n");
		}
//		out.print(sb);
		out.close();
		out.flush();
	}
	static class Pair
	{
		int x;	
		int y;	
		Pair(int a,int b)
		{
			x=a;
			y=b;
		}
		@Override
		public String toString() 
		{
			return x+" "+y;
		}
	}
	static void arraySort(int arr[])
	{
		ArrayList<Integer> a=new ArrayList<Integer>();
		for (int i = 0; i < arr.length; i++) {
			a.add(arr[i]);
		}
		Collections.sort(a);
		for (int i = 0; i < arr.length; i++) {
			arr[i]=a.get(i);
		}
	}
	static void solve() throws IOException
	{
		int n=sc.nextInt(),q=sc.nextInt();
		String str=sc.next();
		int arr[]=new int[n+1];
		for(int i=0;i<n;i++)
		{
			if(str.charAt(i)=='+')
			{
				arr[i+1]=1;
				if((i&1)==1)
					arr[i+1]=-1*arr[i+1];
			}
			else
			{
				arr[i+1]=-1;
				if((i&1)==1)
					arr[i+1]=-1*arr[i+1];				
			}
		}
		for(int i=1;i<=n;i++)
		{
			arr[i]=arr[i]+arr[i-1];
		}
		while(q-->0)
		{
			int l=sc.nextInt(),r=sc.nextInt();
			int sum=arr[r]-arr[l-1];
			if(sum==0)
				out.println("0");
			else
			{
				int len=r-l+1;
				if((len&1)==0)
					out.println("2");
				else
					out.println("1");
			}
		}
		
	}
	static double dfs(Node ver,Node par)
	{
		if(ver.adj.size()==1 && ver.adj.get(0)==par)
		{
			return 0;
		}
		else
		{
			double sum=0,c=0;			
			for(Node child: ver.adj)
			if(child!=par)
			{
				c++;
				sum+=dfs(child, ver);
			}
			return 1+(sum/c);
		}
	}
	static int LOWER_BOUND(ArrayList<Integer> arr,int x)
	{
		int low=0,high=arr.size();
		int ans=0;
		while(low<=high)
		{
			int mid=(low+high)/2;
			if(arr.get(mid)==x)
			{
				ans=arr.get(mid);
				break;
			}
			else if(arr.get(mid)<x)
			{
				ans=arr.get(mid);
				low=mid+1;
			}
			else
				high=mid-1;
		}
		return ans;
	}
	static int gcd(int a,int b)
	{
		return (b==0)?a:gcd(b,a%b);
	}
	static class UnionFind
	{
		  private int size;
		  private int[] sz;
		  private int[] parent;
		  private int numComponents;
		  public UnionFind(int size,Pair dancers[]) 
		  {
		    if (size <= 0) throw new IllegalArgumentException("Size <= 0 is not allowed");
		    this.size = numComponents = size;
		    sz = new int[size];
		    parent = new int[size];
		    for (int i = 0; i < size; i++) 
		    {
		      parent[i] = i; 									// Link to itself (self root)
		      sz[i] = 1; 										// Each component is originally of size one
		    }
		  }
		  public int find(int p) 
		  {
		    int root = p;
		    while (root != parent[root])
		    	root = parent[root];
		    while (p != root)
		    {
		      int next = parent[p];
		      parent[p] = root;
		      p = next;
		    }
		    return root;
		  }
		  public boolean isConnected(int p, int q) 
		  {
		    return find(p) == find(q);
		  }
		  public int componentSize(int x) 
		  {
		    return sz[find(x)];
		  }
		  public int size() 
		  {
		    return size;
		  }
		  public int components() 
		  {
		    return numComponents;
		  }
		  public void unify(int p, int q) 
		  {
		    int root1 = find(p);
		    int root2 = find(q);
		    if(root1==root2)
		    {
		    	return;
		    }
		    else if (sz[root1] < sz[root2]) 
		    {
		    	parent[root1] = root2;
		    	sz[root2] += sz[root1];
		    	sz[root1] = 0;
		  } 
		    else 
		    {
		    	parent[root2] = root1;
		    	sz[root1] += sz[root2];
		    	sz[root2] = 0;
		    }
		    numComponents--;
		  }
		  void calc()
		  {
			  for(int i=0;i<size;i++)
				  find(i);
			  
		  }
	}
	static class Node
	{
		int vertex;
		ArrayList<Node> adj;
		boolean rec;
		boolean vis;
		int color;
		Node(int v)
		{
			vertex=v;
			adj=new ArrayList<Node>();
			vis=false;
			color=-1;
		}
		@Override
		public String toString() 
		{
			return vertex+" ";
		}
	}
	static class Edge
	{
		Node a;
		Node b;
		Edge(Node m,Node n)
		{
			this.a=m;
			this.b=n;
		}
		@Override
		public String toString() {
			return a.vertex+" "+b.vertex;
		}
	}
	static long power(long x, long y)
	  {
	    long res = 1; 
	    x = x % mod; 
	    if (x == 0)
	      return 0; 
	    while (y > 0)
	    {
	    	if ((y & 1) != 0)
	    		res = (res * x) % mod;
	    	
	    	y = y >> 1; // y = y/2
	    	x = (x * x) % mod;
	    }
	    return res;
	  }
	static long binomialCoeff(long n, long k)
    {
        long res = 1;
        if(k>n)
        	return 0;
        // Since C(n, k) = C(n, n-k)
        if (k > n - k)
            k = n - k;
 
        // Calculate value of
        // [n * (n-1) *---* (n-k+1)] / [k * (k-1) *----* 1]
        for (long i = 0; i < k; ++i) {
            res *= (n - i);
            res /= (i + 1);
        }
 
        return res;
    }
	static class FastReader
	{
        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;
 
        FastReader(InputStream is) 
        {
            in = is;
        }
 
        int scan() throws IOException 
        {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }
 
        String next() throws IOException 
        {
            int c;
            for (c = scan(); c <= 32; c = scan());
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }
 
        int nextInt() throws IOException 
        {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
 
        long nextLong() throws IOException 
        {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }
	static class Reader 
	{
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
 
        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(
                new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') {
                    if (cnt != 0) {
                        break;
                    }
                    else {
                        continue;
                    }
                }
                buf[cnt++] = (byte)c;
            }
            return new String(buf, 0, cnt);
        }
 
        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
 
            if (neg)
                return -ret;
            return ret;
        }
 
        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }
 
        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
 
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
 
            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }
 
            if (neg)
                return -ret;
            return ret;
        }
 
        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0,
                                 BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }
 
        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }
 
        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
        public void printarray(int arr[])
        {
        	for (int i = 0; i < arr.length; i++)
				System.out.print(arr[i]+" ");
        	System.out.println();
        }
    }
}








