description: 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.
solution: //package com.company;
  
  import java.io.*;
  import java.lang.reflect.Array;
  import java.text.DecimalFormat;
  import java.util.*;
  
  public class Main {
  
      static boolean[] primecheck = new boolean[1000002];
  
      public static void main(String[] args) throws IOException {
          OutputStream outputStream = System.out;
          FastReader in = new FastReader();
          PrintWriter out = new PrintWriter(outputStream);
          PROBLEM solver = new PROBLEM();
          int t = 1;
          t = in.nextInt();
          for (int i = 0; i < t; i++) {
              solver.solve(in, out);
          }
          out.close();
      }
  
      static class PROBLEM {
  
          public void solve(FastReader in, PrintWriter out) {
  
             int n = in.nextInt();
             char[][] s = new char[2][n];
  
              for (int i = 0; i < 2; i++) {
                  s[i] = in.nextLine().toCharArray();
              }
  
              int[] c = new int[n];
              for (int i = 0; i < n; i++) {
                  if(s[0][i] == '0' && s[1][i] == '0') c[i] = 0;
                  if(s[0][i] == '0' && s[1][i] == '1') c[i] = 1;
                  if(s[0][i] == '1' && s[1][i] == '0') c[i] = 2;
                  if(s[0][i] == '1' && s[1][i] == '1') c[i] = 3;
              }
  
              //out.println(Arrays.toString(c));
              int sum = 0;
  
              for (int i = 0; i < n; i++) {
  
                  if(c[i] == 0) sum+=1;
                  if(c[i] == 1) sum+=2;
                  if(c[i] == 2) sum+=2;
  
                  if(c[i] == 3){
                      if(i>0 && c[i-1] == 0){
                          sum+=1;
                          c[i-1] = -1;
                      }
                      else if(i<n-1 && c[i+1] == 0){
                          sum+=2;
                          c[i+1] = -1;
                      }
                  }
                 // out.print(sum + " ");
              }
  
              out.println(sum);
  
  //            int n = in.nextInt();
  //            int[] a = in.readArray(n);
  //            int l = 0;
  //            HashSet<Integer> hs = new HashSet<>();
  //            for (int i = 0; i < n; i++) {
  //                hs.add(a[i]);
  //            }
  //            int[] r = new int[hs.size()+1];
  //            for (int i = 0; i < hs.size(); i++) {
  //                int b = in.nextInt();
  //                r[b]++;
  //            }
  //
  //            int days = 0, curResearch = 1;
  //
  //            for (int i = 0; i < n; i++) {
  //                if(curResearch == hs.size()) break;
  //                if(a[i] == 0){
  //                    days++;
  //                    if(r[curResearch] == 0) curResearch++;
  //                    if(curResearch == hs.size()) break;
  //                    while(r[curResearch] == 0) curResearch++;
  //                    r[curResearch]--;
  //
  //                }else{
  //                    if(r[a[i]] == 0){
  //                        days++;
  //                    }else{
  //                        days++;
  //                        r[a[i]]--;
  //                    }
  //                }
  //            }
  //
  //            out.println(days);
  
  //            int n = in.nextInt();
  //            int[] a = in.readArray(n);
  //
  //            int[] l = new int[n], r = new int[n];
  //            int m = 0;
  //            l[0] = 1;
  //
  //            int sum = 0;
  //            int flag = 0;
  //            for (int i = 0; i < n; i++) {
  //                if(a[i] != 0) flag = 1;
  //            }
  //
  //            if(flag == 0) {
  //                out.println("NO");
  //                return;
  //            }
  //
  //            for (int i = 0; i < n; i++) {
  //                sum+=a[i];
  //                if(sum == 0){
  //                    if(i == n-1 && r[0] == 0){
  //
  //                        if(a[i] == 0) continue;
  //                        sum = a[i];
  //                        r[m++] = i;
  //                        l[m] = i+1;
  //                        if(i == n-1) {
  //                            r[m++] = i + 1;
  //                            break;
  //                        }
  //                    }
  //                }
  //
  //                if(i == n-1){
  //                    r[m++] = n;
  //                }
  //            }
  //
  //            out.println("YES");
  //            out.println(m);
  //
  //            for (int i = 0; i < m; i++) {
  //                out.println(l[i] + " " + r[i]);
  //            }
  
  //            int n = in.nextInt();
  //            int[] a = in.readArray(n);
  //
  //            a = mergeSort(a);
  //            boolean isValid = true;
  //
  //            for (int i = 0; i < n-1; i++) {
  //                if(a[i+1]-a[i]>1){
  //                    isValid = false;
  //                    break;
  //                }
  //            }
  //            int ans = 0;
  //
  //            if(isValid){
  //                int m =998244353;
  //                int max = a[n-1],maxL = 0, cntMaxL = 0, cntMax = 0;
  //                for (int i = n-1; i >= 0 ; i--) {
  //                    if(a[i] != max && maxL == 0){
  //                        maxL = a[i];
  //                    }else cntMax++;
  //                    if(maxL != 0){
  //                        if(a[i] == maxL) cntMaxL++;
  //                        else break;
  //                    }
  //                }
  //
  //                if(cntMax>1){
  //                    ans = factorial(n, m);
  //                    ans = ((ans%m) * (n%m)) %m;
  //                }else{
  //                    int rem = n - cntMax-cntMaxL;
  //                    int nowRem = rem;
  //                    long sub = 0;
  //                    while(nowRem>0){
  //                        sub+= (nPr(rem, nowRem, m) * factorial(n-1-nowRem, m));
  //                        nowRem--;
  //                    }
  //                    ans = factorial(n-1,m);
  //                    ans = ((ans%m) * ((n-1)%m)) %m;
  //                    ans = (int)(((ans%m) - (sub%m) + m) % m);
  //                }
  //            }
  //            out.println(ans);
          }
      }
  
      static int nPr(int n, int r, int m){
          int num = factorial(n, m);
          int den = factorial(r, m);
          den*=factorial(n-r, m);
  
          return num/den * factorial(r, m);
      }
  
      static int factorial(int n, int m){
          int ans = 1;
          while(n>0){
              ans = ((ans%m)*(n*m))%m;
              n--;
          }
          return ans;
      }
  
      static boolean isPalindromeI(int n){
  
          int d = 0;
          int y = n;
          while(y>0){
              d++;
              y/=10;
          }
  
          int[] a = new int[d];
          for (int i = 0; i < d; i++) {
              a[i] = n%10;
              n/=10;
          }
  
          System.out.println(Arrays.toString(a));
          for (int i = 0; i < d / 2; i++) {
              if(a[i] != a[d-i-1]) return false;
          }
          return true;
      }
  
      static long gcd(long a, long b) {
          if (b == 0) return a;
          return gcd(b, a % b);
      }
  
      static boolean isSquare(double a) {
          boolean isSq = false;
          double b = Math.sqrt(a);
          double c = Math.sqrt(a) - Math.floor(b);
  
          if (c == 0) isSq = true;
  
          return isSq;
      }
  
      static int exponentMod(int A, int B, int C) {
  
          // Base cases
          if (A == 0)
              return 0;
          if (B == 0)
              return 1;
  
          // If B is even
          long y;
          if (B % 2 == 0) {
              y = exponentMod(A, B / 2, C);
              y = (y * y) % C;
          }
  
          // If B is odd
          else {
              y = A % C;
              y = (y * exponentMod(A, B - 1,
                      C) % C) % C;
          }
  
          return (int) ((y + C) % C);
      }
  
  
      static class pair implements Comparable<pair>{
          int x,y;
          pair(int xi, int yi){
              x=xi;
              y=yi;
          }
          @Override
          public int compareTo(pair other){
              if(this.x>other.x){return 1;}
              if(this.x<other.x){return -1;}
              if(this.y>other.y){return 1;}
              if(this.y<other.y){return -1;}
              return 0;
          }
      }
  
  //    public static class Pair<U extends Comparable<U>, V extends Comparable<V>> implements Comparable<Pair<U, V>> {
  //        public U x;
  //        public V y;
  //
  //        public Pair(U x, V y) {
  //            this.x = x;
  //            this.y = y;
  //        }
  //
  //        public int hashCode() {
  //            return (x == null ? 0 : x.hashCode() * 31) + (y == null ? 0 : y.hashCode());
  //        }
  //
  //        public boolean equals(Object o) {
  //            if (this == o)
  //                return true;
  //            if (o == null || getClass() != o.getClass())
  //                return false;
  //            Pair<U, V> p = (Pair<U, V>) o;
  //            return (x == null ? p.x == null : x.equals(p.x)) && (y == null ? p.y == null : y.equals(p.y));
  //        }
  //
  //        public int compareTo(Pair<U, V> b) {
  //            int cmpU = x.compareTo(b.x);
  //            return cmpU != 0 ? cmpU : y.compareTo(b.y);
  //        }
  //
  //        public String toString() {
  //            return String.format("(%s, %s)", x.toString(), y.toString());
  //        }
  //
  //    }
  
      static class FastReader {
          BufferedReader br;
          StringTokenizer st;
  
          public FastReader() {
              br = new BufferedReader(new InputStreamReader(System.in));
          }
  
          String next() {
              while (st == null || !st.hasMoreElements()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
  
          int nextInt() {
              return Integer.parseInt(next());
          }
  
          long nextLong() {
              return Long.parseLong(next());
          }
  
          double nextDouble() {
              return Double.parseDouble(next());
          }
  
          char nextChar() {
              return next().charAt(0);
          }
  
          boolean nextBoolean() {
              return !(nextInt() == 0);
          }
          // boolean nextBoolean(){return Boolean.parseBoolean(next());}
  
          String nextLine() {
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
  
          public int[] readArray(int size) {
              int[] array = new int[size];
              for (int i = 0; i < size; i++) array[i] = nextInt();
              return array;
          }
  
      }
  
      private static int[] mergeSort(int[] array) {
  
          //array.length replaced with ctr
          int ctr = array.length;
          if (ctr <= 1) {
              return array;
          }
  
          int midpoint = ctr / 2;
  
          int[] left = new int[midpoint];
          int[] right;
  
          if (ctr % 2 == 0) {
              right = new int[midpoint];
          } else {
              right = new int[midpoint + 1];
          }
  
          for (int i = 0; i < left.length; i++) {
              left[i] = array[i];
          }
  
          for (int i = 0; i < right.length; i++) {
              right[i] = array[i + midpoint];
          }
  
          int[] result = new int[array.length];
  
          left = mergeSort(left);
          right = mergeSort(right);
  
          result = merge(left, right);
  
          return result;
      }
  
      private static int[] merge(int[] left, int[] right) {
  
          int[] result = new int[left.length + right.length];
          int leftPointer = 0, rightPointer = 0, resultPointer = 0;
  
          while (leftPointer < left.length || rightPointer < right.length) {
  
              if (leftPointer < left.length && rightPointer < right.length) {
  
                  if (left[leftPointer] < right[rightPointer]) {
                      result[resultPointer++] = left[leftPointer++];
                  } else {
                      result[resultPointer++] = right[rightPointer++];
                  }
              } else if (leftPointer < left.length) {
                  result[resultPointer++] = left[leftPointer++];
              } else {
                  result[resultPointer++] = right[rightPointer++];
              }
          }
          return result;
      }
  
      public static void Sieve(int n) {
  
          Arrays.fill(primecheck, true);
          primecheck[0] = false;
          primecheck[1] = false;
  
          for (int i = 2; i * i < n + 1; i++) {
              if (primecheck[i]) {
                  for (int j = i * 2; j < n + 1; j += i) {
                      primecheck[j] = false;
                  }
              }
          }
      }
  }
  
  
  