There is a chessboard of size n by n. The square in the i-th row from top and j-th column from the left is labelled (i,j).

Currently, Gregor has some pawns in the n-th row. There are also enemy pawns in the 1-st row. On one turn, Gregor moves one of his pawns. A pawn can move one square up (from (i,j) to (i-1,j)) if there is no pawn in the destination square. Additionally, a pawn can move one square diagonally up (from (i,j) to either (i-1,j-1) or (i-1,j+1)) if and only if there is an enemy pawn in that square. The enemy pawn is also removed.

Gregor wants to know what is the maximum number of his pawns that can reach row 1?

Note that only Gregor takes turns in this game, and the enemy pawns never move. Also, when Gregor's pawn reaches row 1, it is stuck and cannot make any further moves.

Input

The first line of the input contains one integer t (1≤ t≤ 2⋅ 10^4) — the number of test cases. Then t test cases follow.

Each test case consists of three lines. The first line contains a single integer n (2≤ n≤ 2⋅{10}^{5}) — the size of the chessboard.

The second line consists of a string of binary digits of length n, where a 1 in the i-th position corresponds to an enemy pawn in the i-th cell from the left, and 0 corresponds to an empty cell.

The third line consists of a string of binary digits of length n, where a 1 in the i-th position corresponds to a Gregor's pawn in the i-th cell from the left, and 0 corresponds to an empty cell.

It is guaranteed that the sum of n across all test cases is less than 2⋅{10}^{5}.

Output

For each test case, print one integer: the maximum number of Gregor's pawns which can reach the 1-st row.

Example

Input


4
3
000
111
4
1111
1111
3
010
010
5
11001
00000


Output


3
4
0
0

Note

In the first example, Gregor can simply advance all 3 of his pawns forward. Thus, the answer is 3.

In the second example, Gregor can guarantee that all 4 of his pawns reach the enemy row, by following the colored paths as demonstrated in the diagram below. Remember, only Gregor takes turns in this "game"!

<image>

In the third example, Gregor's only pawn is stuck behind the enemy pawn, and cannot reach the end.

In the fourth example, Gregor has no pawns, so the answer is clearly 0.
1
20
01001100111111000100
00101100011010001110

8

#include<iostream>
#include <math.h>
#include<bits/stdtr1c++.h>
#include<vector>
#define mod 998244353
#define pqll priority_queue<ll,vector<ll>,greater<ll>>
#define ll long long
#ifndef ONLINE_JUDGE
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#else
#define trace1(x)
#define trace2(x,y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)
#endif

#define ll long long
#define fr(i,a,b) for(ll i = a;i<b;i++)
#define pie 3.14159265358979
#define pb push_back
// #define mp make_pair
#define fri(i,a,b) for(ll i = a;i>=b;i--)
#define pqll priority_queue<ll,vector<ll>,greater<ll>>
// #define pq priority_queue<ll>
#define pr pair<ll,ll>
#define prr pair<ll,pr>
#define pqr priority_queue<pair<ll,ll>>
#define ld long double
#define precise(a) cout << fixed << setprecision(a);
#define sumvec(v,c) for(int i = 0;i<v.size();i++){c += v[i];}
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define zn(a,b,c) for(ll a=b;a<c;a++)
#define nz(a,b,c) for(ll a=b;a>c;a--)
#define MAX 1000000007
#define st stack
#define out(a) cout<<a<<"\n"
#define in(a) cin>>a
#define loop() for(;;)
#define frx(x,s) for(auto x: s)
#define read(v,n) for(int i = 0; i<n ; i++){ll t;cin>>t;v.pb(t);}
#define read1(v,n) for(int i = 1; i<n ; i++){cin>>v[i];}
#define sortv(ouas) sort(ouas.begin(),ouas.end())
#define outvec(v) for(int i = 0;i<v.size();i++){cout<<v[i]<<" ";}
#define sumvec(v,c) for(int i = 0;i<v.size();i++){c += v[i];}
#define outpair(v) for(auto i: v){cout<<i.first<<" "<<i.second<<endl;}
#define ump unordered_map
using namespace std;
vector<string> a;
bool cmp(pair<ll,ll> a,pair<ll,ll> b ){
    if(a.first == b.first){
        return a.second > b.second;
    }
    return a.first < b.first;
}

bool isPal(string s1){
    return s1 == string(s1.rbegin(), s1.rend());
}

bool check(vector<ll> v,ll d,ll c){
    ll last=-1e9;
    ll cnt=0;
    zn(i,0,v.size()){
        if(v[i]-last >= d){
            cnt++;
            last=v[i];
            if(cnt>=c) return true;

        }
    }
    return false;
}
bool bange(vector<ll> v,ll m,ll n){
    ll kinibangi=0;
    ll time=0;
    int k=1;
    zn(i,0,v.size()){
        k=2;
        time=v[i];
        
        while(time<=m){
            time+=v[i]*(k++);
            kinibangi++;
        }
        if(kinibangi>=n) return true;
    }
    return false;
}

ll power(ll base, ll exp){
    ll ans = 1;
    while(exp > 0){
        if(exp%2){
            ans *= base;
            ans%=mod;
            
        }
        base *= base;
        base %= mod;
        exp /= 2;
        
        // ans = base;
    }
    return ans%mod;
}
void bact(string s,ll currl,ll tar,vector<string>& ans){
    if(currl<=0){
        return;
    }
    if(s.empty()){
        return;
    }
    if(currl>2*tar){
        return;
    }
    if(currl==tar){
        cout<<s<<endl;
        ans.push_back(s);
    }
    string temp=s;
    temp.pop_back();
    bact(temp,currl-1,tar,ans);
    bact(s+s,2*currl,tar,ans);
}
bool win11(ll kinne,ll n,vector<ll> a,vector<ll> b){
    ll n1=n+kinne;
    ll un=n1-(n1/4);
    ll bakaya=0;
    ll l=un-kinne;
    zn(i,0,l){
        bakaya+=a[i];
    }
    ll mera1=kinne*100+bakaya;
    ll ohde1=0;
    ll m=min(un,n);
    zn(i,0,m){
        ohde1+=b[i];
    }
    return mera1>=ohde1;
}

struct Pair{
    ll node;
    vector<ll> temp;
};
vector<ll> ans;

bool help(stack<ll>& s,ump<ll,list<ll>>& mp,vector<ll>&v,ll src,vector<ll>&c){
    
    // c[src]=1;
    s.push(src);
  
        v[src]=1;
        if(v[src]==2){
            return true;
        }
        for(auto i:mp[src]){
            trace2(i,src);
            if(v[i]==1) {
                //cycle
                trace1(i);
                ans.pb(i);
                // cout<<s.size()<<endl;
                while(not s.empty()){
                    ans.pb(s.top());
                    if(s.top()==i) break;
                    s.pop();
                }

                return true;
            }
            if(v[i]==0 && help(s,mp,v,i,c)){
                // trace1(i);
                return true;
            }
        }
    
    v[src]=2;
    s.pop();
    return false;
}

void printg(ump<ll,list<ll>> mp){
        for(auto i:mp){
            // cout<<i.first<<"--->";
            for(auto j:i.second){
                cout<<j;
            }
            cout<<endl;
        }
    }

void solve(){
    ll n;
    cin>>n;
    ll s[n];
    ll t[n];
    string st,st1;
    cin>>st>>st1;
    zn(i,0,n){
        s[i]=st[i]-'0';
    }
    zn(i,0,n){
        t[i]=st1[i]-'0';
    
    }
    // zn(i,0,n){
    //     cout<<s[i];
    // }
    ll ans=0;
    // cin>>s>>t;
    if(t[0]==1 && s[1]==1){
        s[1]=0;
        ans++;
    }
    if(t[n-1]==1 && s[n-2]==1){
        s[n-2]=0;
        ans++;
    }
    fr(i, 0, n) {
        if (s[i] == t[i] && s[i] == 1) {
            if (i > 0 && s[i - 1] == 1) {
                ans++;
                s[i - 1] = 0;
                t[i] = 0;
            }
            else if (i < n - 1 && s[i + 1] == 1) {
                ans++;
                s[i + 1] = 0;
                t[i] = 0;
            }
        }
        else if (s[i] == 0 && t[i] == 1) {
            ans++;
            t[i] = 0;
        }
    }
    cout << ans << "\n";

}

int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE      
    // code
    
    ll t=1;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
