#include using namespace std; int T,n,ans; struct Block{ string s,t; int ed,cnt[6]; inline void Ins(){ s = '.' + s,t = '.' + t; return ; } inline void Scan(int nowst){ if(nowst <= ed)return ; for(int i = nowst;i <= n;i++){ if(t[i] == '0')break;//都没有扫到最后一位 cnt[s[i] - '0']++; ed = i; } return ; } inline void Append(){ ed++; cnt[s[ed] - '0']++; return ; } }b[6]; inline void Execute(Block& b1,Block& b2){ if(b1.cnt[0] >= b2.cnt[0] && b1.cnt[1] >= b2.cnt[1]){ // cerr<<"case1"<= b2.cnt[0]){ // cerr<<"case2"<= b2.cnt[1]){ // cerr<<"case3"<>T; while(T--){ cin>>n>>b[1].s>>b[2].s>>b[1].t>>b[2].t; ans = 0; b[1].Ins(),b[2].Ins(); b[1].ed = b[2].ed = 0; while(b[1].ed != n || b[2].ed != n){ int st = min(b[1].ed,b[2].ed) + 1; b[1].Scan(st),b[2].Scan(st); // cerr<<"scan from "< b[2].ed){ // cerr<<"MAIN CASE 2"<