A binary string is a string that consists of characters 0 and 1. A bi-table is a table that has exactly two rows of equal length, each being a binary string.

Let \operatorname{MEX} of a bi-table be the smallest digit among 0, 1, or 2 that does not occur in the bi-table. For example, \operatorname{MEX} for \begin{bmatrix} 0011\\\ 1010 \end{bmatrix} is 2, because 0 and 1 occur in the bi-table at least once. \operatorname{MEX} for \begin{bmatrix} 111\\\ 111 \end{bmatrix} is 0, because 0 and 2 do not occur in the bi-table, and 0 < 2.

You are given a bi-table with n columns. You should cut it into any number of bi-tables (each consisting of consecutive columns) so that each column is in exactly one bi-table. It is possible to cut the bi-table into a single bi-table — the whole bi-table.

What is the maximal sum of \operatorname{MEX} of all resulting bi-tables can be?

Input

The input consists of multiple test cases. The first line contains a single integer t (1 ≤ t ≤ 10^4) — the number of test cases. Description of the test cases follows.

The first line of the description of each test case contains a single integer n (1 ≤ n ≤ 10^5) — the number of columns in the bi-table.

Each of the next two lines contains a binary string of length n — the rows of the bi-table.

It's guaranteed that the sum of n over all test cases does not exceed 10^5.

Output

For each test case print a single integer — the maximal sum of \operatorname{MEX} of all bi-tables that it is possible to get by cutting the given bi-table optimally.

Example

Input


4
7
0101000
1101100
5
01100
10101
2
01
01
6
000000
111111


Output


8
8
2
12

Note

In the first test case you can cut the bi-table as follows:

  * \begin{bmatrix} 0\\\ 1 \end{bmatrix}, its \operatorname{MEX} is 2.
  * \begin{bmatrix} 10\\\ 10 \end{bmatrix}, its \operatorname{MEX} is 2.
  * \begin{bmatrix} 1\\\ 1 \end{bmatrix}, its \operatorname{MEX} is 0.
  * \begin{bmatrix} 0\\\ 1 \end{bmatrix}, its \operatorname{MEX} is 2.
  * \begin{bmatrix} 0\\\ 0 \end{bmatrix}, its \operatorname{MEX} is 1.
  * \begin{bmatrix} 0\\\ 0 \end{bmatrix}, its \operatorname{MEX} is 1.



The sum of \operatorname{MEX} is 8.
//package Java;
import java.io.*;
import java.text.DecimalFormat;
import java.util.*;
import java.util.Map.Entry;

public class Main {
	static final PrintWriter out = new PrintWriter(System.out, true);
    static final FastScanner sc = new FastScanner();
    public static void main(String[] args)  {
    		int t=sc.nextInt();
    		while(t-->0) {
    			int n= sc.nextInt();
    			String s1=sc.next();
    			String s2=sc.next();
    			int o=0,z=0;
    			for(int i=0;i<n;i++) {
    				if(s1.charAt(i)=='0') z++;
    				else o++;
    			}
    			for(int i=0;i<n;i++) {
    				if(s2.charAt(i)=='0') z++;
    				else o++;
    			}
    			if(o==0||z==0) {
    				if(o==0) {
    					out.println(z/2);
    				}else {
    					out.println("0");
    				}
    			}else {
    				long ans=0;
    				for(int i=0;i<n;i++) {
    					if((s1.charAt(i)=='0'&&s2.charAt(i)=='1')||(s2.charAt(i)=='0'&&s1.charAt(i)=='1')) ans+=2;
    					else if((s1.charAt(i)=='0'&&s2.charAt(i)=='0')) {
    						ans+=1;
    						if(i==n-1) continue;
    						else {
    							if(s1.charAt(i+1)=='1'||s2.charAt(i+1)=='1') {
    								if(s1.charAt(i+1)=='0'||s2.charAt(i+1)=='0') continue;
    								ans+=1;
    								i++;
    							}
    						}
    					}else if((s1.charAt(i)=='1'&&s2.charAt(i)=='1')){
    						if(i==n-1) continue;
    						else {
	    							if(s1.charAt(i+1)=='0'||s2.charAt(i+1)=='0') {
	    								ans+=2;i++;
	    							}
    							}
    					}
    				}
    				out.println(ans);
    			}
    		}
    		out.close();
    }
    static int bsg(int a[],int t,int n) {
    	int ans=n,l=0,r=n-1;
    	while(l<=r) {
    		int m=(l+(r-l)/2);
    		if(a[m]>=t) {
    			ans=a[m];
    			r=m-1;
    		}else {
    			l=m+1;
    		}
    	}
    	return ans;
    }
    static int bss(int a[],int t,int n) {
    	int ans=-1,l=0,r=n-1;
    	while(l<=r) {
    		int m=(l+(r-l)/2);
    		if(a[m]<=t) {
    			ans=a[m];
    			l=m+1;
    		}else {
    			r=m-1;
    		}
    	}
    	return ans;
    }
    static long Cr(int n, int r,int mod,long fac[],long inv[]) {
    	if(n<r) return 0L;
		return fac[n]*(inv[r]*inv[n - r]%mod)%mod;

//    	long fac[]=new long[100000];
//    	long inv[]=new long[100000];
//    	fac[0]=fac[1]=1;
//    	fac[i]=modmul(fac[i-1],i,m);
//		inv[i] =modpow(fac[i], m - 2,m);
//    	long ans = 1;
//	    ans *= (Cr(n-x,more,m,fac,inv)*fac[more])%m;
//	    ans %= m;
	}
	  static void sieveOfEratosthenes(int n,int a[],boolean prime[])
	    {
	        for (int i = 0; i <= n; i++)
	            prime[i] = true;
	        	int ii=0;
	        for (int p = a[ii];ii<n;ii++)
	        {
	            if (prime[p] == true)
	            {
	                for (int i = p * p; i <= n; i += p)
	                    prime[i] = false;
	            }
	        }
	    }
	 static long modDivide(long a, long b, int m)
	  {
	      a = a % m;
	      long inv = modInverse(b, m);
	      if (inv == -1) return -1;
	      else
	      {
	        long c = (inv * a) % m ;
	        return c;
	      }
	  }
	  static long modInverse(long a, int m)
	    {
	        long g = gcd(a, m);
	        if (g != 1) return -1;
	        else
	        {
	        	return modpow(a,m-2,m);
	        }
	    }
	  public static double logx(long m,int x)
	    {
	        double result = (double)(Math.log(m) / Math.log(x));
	  
	        return result;
	    }
	     static double setPrecision(double ans,int k){
	    	 double y=Math.pow(10,k);
	    	 return Math.round(ans*y)/y;
	     }
	  public static double log2(double m)
	    {
	        double result = (double)(Math.log(m) / Math.log(2));
	  
	        return result;
	    }
	public static void sort(long[] arr){//because Arrays.sort() uses quicksort which is in worst O(n^2)
		//Collections.sort() uses merge sort
		ArrayList<Long> ttttt = new ArrayList<Long>();
		for(long y: arr)ttttt.add(y);Collections.sort(ttttt);
		for(int i=0; i < arr.length; i++)arr[i] = ttttt.get(i);
	}
	public static void sort(int[] arr){//because Arrays.sort() uses quicksort which is dumb
		//Collections.sort() uses merge sort
		ArrayList<Integer> ttttt = new ArrayList<>();
		for(int y: arr)ttttt.add(y);Collections.sort(ttttt);
		for(int i=0; i < arr.length; i++)arr[i] = ttttt.get(i);
	}
	static boolean check(double[] a,double m,int n,int k) {
		int ans=0;
		for(int i=0;i<n;i++) {
			ans+=(Math.floor(a[i]/m));
			if(ans>=k) return true;
		}
		return ans>=k;
	}
	     static boolean isKthBitSet(long n, int k) { 
			if ((n & (1 << (k - 1))) > 0) 
			return true;
			else
			return false;
			
		 } 
	     static long modpow(long a,long b,int m) {
	    	 if(b==0) return 1;
	    	 if(b==1) return a;
	    	 long ans=0;
	    	 long t=modpow(a,b/2,m);
	    	 ans=modmul(t,t,m);
	    	 if(b%2!=0) ans=modmul(a,ans,m);
	    	 return ans;
	     }
		static long modmul(long a,long b,int m) {
			return mod(mod(a,m)*mod(b,m),m);
		}
		static long mod(long x,int m) {
			return ((x%m)+m)%m;
		}
		 static int octaltodecimal(int deciNum)
		    {
		        int octalNum = 0, countval = 1;
		        int dNo = deciNum;
		        while (deciNum != 0) {
		 
		            // decimals remainder is calculated
		            int remainder = deciNum % 8;
		 
		            // storing the octalvalue
		            octalNum += remainder * countval;
		 
		            // storing exponential value
		            countval = countval * 10;
		            deciNum /= 8;
		        }
		       return octalNum;
		    }
		
	  public static int floorSqrt(int x) 
	    { 
	        // Base Cases 
	        if (x == 0 || x == 1) 
	            return x; 
	  
	        // Do Binary Search for floor(sqrt(x)) 
	        int start = 1, end = x, ans=0; 
	        while (start <= end) 
	        { 
	            int mid = (start + end) / 2; 
	  
	            // If x is a perfect square 
	            if (mid*mid == x) 
	                return mid; 
	  
	            // Since we need floor, we update answer when mid*mid is 
	            // smaller than x, and move closer to sqrt(x) 
	            if (mid*mid < x) 
	            { 
	                start = mid + 1; 
	                ans = mid; 
	            } 
	            else   // If mid*mid is greater than x 
	                end = mid-1; 
	        } 
	        return ans; 
	    } 
		static int div(int n,int b) {
			int g=-1;
			for(int i=2;i<=Math.sqrt(n);i++) {
				if(n%i==0&&i!=b) {
					g=i;
					break;
				}
			}
			return g;
		}
	 
	  
	  public static long gcd(long a, long a2) 
	    { 
	        if (a == 0) 
	            return a2; 
	          
	        return gcd(a2%a, a); 
	    } 
	   public static long lcm(int a, int b)  
	  {  
	     return (a*b)/gcd(a, b);  
	  }  
	   public static boolean isPrime1(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           for (int i = 2; i <= Math.sqrt(n) + 1; i++) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       }
       public static boolean isPrime(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           if (n % 2 == 0) {
               return false;
           }
           for (int i = 3; i <= Math.sqrt(n) + 1; i = i + 2) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       }
	      
       static class FastScanner {
           BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
           StringTokenizer strToken = new StringTokenizer("");
           String next() {
        	   while (!strToken.hasMoreTokens()) {
        		   try {
        			   strToken = new StringTokenizer(input.readLine()); 
        		   }  catch (IOException e) { 
        			    e.printStackTrace();
        			  } 
        	   } return strToken.nextToken(); 
        	}
           String nextLine() {
        	   String strrrrr = ""; try {
        		   strrrrr = input.readLine(); 
        	   } catch (IOException e) {
        			   e.printStackTrace(); 
        		}
        	   return strrrrr; 
           }
           int nextInt() {
        	   return Integer.parseInt(next()); 
        	}
           int[] nextIntArray(int n) {
        	   int[] a = new int[n]; 
        	   for (int i = 0; i < n; i++) a[i] = nextInt(); 
        	   return a; 
           }
           long nextLong() {
        	   return Long.parseLong(next()); 
        	}
           long[] nextLongArray(int n) {
        	   long[] a = new long[n];
        	   for (int i = 0; i < n; i++) a[i] = nextLong(); 
        	   return a; 
        	}
           double nextDouble() {
        	   return Double.parseDouble(next()); 
           }
       }
}
//
//class Pair{
//  int value;
//  int distance;
//  Pair(int value,int distance){
//      this.value=value;
//      this.distance=distance;
//  }
//  
//}
//class sortbydistance implements Comparator<Pair>{
//
//	@Override
//	public int compare(Pair o1, Pair o2) {
//		return o1.distance-o2.distance;
//	}
//	
//}
//class Solution
//{
//  static int[] dijkstra(int n, ArrayList<ArrayList<ArrayList<Integer>>> adj, int S)
//  {
//  	 PriorityQueue<Pair>set=new PriorityQueue<>(new sortbydistance());
//      int dis[]=new int[n];
//      Arrays.fill(dis,Integer.MAX_VALUE);
//      dis[0]=0;
//      while(set.isEmpty()==false) {
//      	Pair p=set.poll();
//      	int u=p.value;
//      	for(int i=0;i<adj.get(u).size();i++) {
//      		int v=adj.get(u).get(i).get(0);
//      		int wt=adj.get(u).get(i).get(1);
//      		if(dis[v]>dis[u]+wt) {
//      			if(dis[v]!=Integer.MAX_VALUE) {
//      				set.remove(new Pair(dis[v],v));
//      			}
//      			dis[v]=dis[u]+wt;
//      			set.add(new Pair(v,dis[v]));
//      		}
//      		
//      	}
//      }
//      
//      
//      return dis;
//  }
//}
//