#include using namespace std; int t,n; string s1,s2,t1,t2; void solve(){ int more1=0,more2=0,lf1=-1,lf2=-1,ans=0,tt1=0; for(int i=0;ilf1&&t1[i]=='1'){ more1=0; int j=i; while(jlf2&&t2[i]=='1'){ more2=0; int j=i; while(j0) ans++,more2--; if(t1[i]=='1'&&t2[i]=='0'&&s2[i]=='1'&&more1>0) ans++,more1--; if(t1[i]=='1'&&t2[i]=='1'&&more1>0&&more2>0) ans++,more2--,more1--; //cout<>t; while(t--){ cin>>n; cin>>s1>>s2>>t1>>t2; solve(); } fclose(stdin); fclose(stdout); } /* 10 0110111100 1111111100 1110000100 0110111011 9 101111111 100111000 110111011 011111111 */