#include using namespace std; int ok( string s, int d ){ for( int i = 0; i < s.size(); ++i ) if( s[ i ] == 'x' ){ int j; for( j = i + 1; j < s.size(); ++j ) if( s[ j ] == 'o' ) break; if( j - i > d ) return 0; for( int k = j + 1; k < s.size(); ++k ) if( s[ k ] == 'x' ) return 0; } return 1; } signed main(){ int D; cin >> D; string A, B; cin >> A >> B; string w = "xxxxxxxxxxxxxx" + A + B + "xxxxxxxxxxxxxx"; int ans = 0; for( int i = 0; i < w.size(); ++i ) for( int j = i; j < w.size(); ++j ) if( ok( w.substr( i, j - i + 1 ), D ) ) ans = max( ans, j - i + 1 ); cout << ans << endl; return 0; }