Problem: You are given two strings s and t consisting of lowercase Latin letters. The length of t is 2 (i.e. this string consists only of two characters).

In one move, you can choose any character of s and replace it with any lowercase Latin letter. More formally, you choose some i and replace s_i (the character at the position i) with some character from 'a' to 'z'.

You want to do no more than k replacements in such a way that maximizes the number of occurrences of t in s as a subsequence.

Recall that a subsequence is a sequence that can be derived from the given sequence by deleting zero or more elements without changing the order of the remaining elements.

Input

The first line of the input contains two integers n and k (2 ≤ n ≤ 200; 0 ≤ k ≤ n) — the length of s and the maximum number of moves you can make. The second line of the input contains the string s consisting of n lowercase Latin letters. The third line of the input contains the string t consisting of two lowercase Latin letters.

Output

Print one integer — the maximum possible number of occurrences of t in s as a subsequence if you replace no more than k characters in s optimally.

Examples

Input


4 2
bbaa
ab


Output


3


Input


7 3
asddsaf
sd


Output


10


Input


15 6
qwertyhgfdsazxc
qa


Output


16


Input


7 2
abacaba
aa


Output


15

Note

In the first example, you can obtain the string "abab" replacing s_1 with 'a' and s_4 with 'b'. Then the answer is 3.

In the second example, you can obtain the string "ssddsdd" and get the answer 10.

In the fourth example, you can obtain the string "aaacaaa" and get the answer 15.

Solution (in JAVA):

Solution:
import java.io.*;
import java.math.*;
import java.util.*;
public class Q6 {
	public static void main(String[] args) { 
		/*Pairs of replacements (First letter, Second letter)
		 * Iterate over all pairs:
		 * (0,K)
		 * (1,K-1)
		 * .
		 * .
		 * .
		 * (K-1,1)
		 * (K,0) Take maximum of results
		 * 
		 * UPD: Fix how many As you want to keep and Bs you want to keep among originals
		 * 
		 * */
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		int N = I.nextInt();
		int K = I.nextInt();
		String S = I.next();
		String T = I.next();
		long ans = 0;
		if (T.charAt(0)==T.charAt(1)) {
			long same = 0;
			for (int i = 0; i < N; i++) {
				same+=S.charAt(i)==T.charAt(0)?1:0;
			}
			same+=K;
			same=min(same,N); //Can't have more letters than length...
			ans=same*(same-1)/2;
		}else {
			int first = 0;
			int second = 0;
			ArrayList<Integer> fir = new ArrayList<Integer>();
			ArrayList<Integer> sec = new ArrayList<Integer>(); //Indices of first and second letters
			for (int i = 0; i < N; i++) {
				first+=S.charAt(i)==T.charAt(0)?1:0;
				second+=S.charAt(i)==T.charAt(1)?1:0;
				if (S.charAt(i)==T.charAt(0)) fir.add(i);
				else if (S.charAt(i)==T.charAt(1)) sec.add(i);
			}
			for (int A = 0; A<=first; A++) {
				for (int B = 0; B<=second; B++) {
					int max = min(K,N-A-B); //either switch K, or switch all untouched
					for (int a = 0; a <= max; a++) {
						//Second letter = max-a
						boolean[] keep = new boolean[N]; //Which letters we're keeping
						char[] UPD = S.toCharArray();//New word constructed (keep original in
						//beginning)
						long pair = B+max-a; //Number of second letter in new string
						for (int i = 0; i < A; i++) {
							int in = fir.get(i);
							keep[in]=true;
						}
						for (int i = second-1; i >= second-B; i--) {
							int in = sec.get(i);
							keep[in]=true;
						}
						int swap = 0;
						for (int i = 0; i < N; i++) {
							if (swap==a) break;
							if (!keep[i]) {
								swap++;
								UPD[i]=T.charAt(0);
								keep[i]=true; //We have touched this up (don't let suffix overlap)
							}
						}
						swap=0;
						for (int i = N-1; i >= 0; i--) {
							if (swap==max-a) break;
							if (!keep[i]) {
								swap++;
								UPD[i]=T.charAt(1);
								keep[i]=true;
							}
						}
						long curans = 0;
						for (int i = 0; i < N; i++) {
							if (UPD[i]==T.charAt(0)) {
								curans+=pair;
							}else if (UPD[i]==T.charAt(1)) pair--;
						}
						ans=max(ans,curans);
						//O.pln(curans+" "+new String(UPD));
					}
				}
			}
		}
		O.pln(ans);
	}
	public static double max(double a, double b) {return Math.max(a, b);}
	public static double min(double a, double b) {return Math.min(a, b);}
	public static long min(long a, long b) {return Math.min(a,b);}
	public static long max(long a, long b) {return Math.max(a,b);}
	public static int min(int a, int b) {return Math.min(a,b);}
	public static int max(int a, int b) {return Math.max(a,b);}
	public static long abs(long x) {return Math.abs(x);}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return max(a,b);
		return GCD(min(a,b),max(a,b)%min(a,b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	public static int pop(long x) { //Returns number of bits within a number
		int cnt = 0;
		while (x>0) {
			if (x%2==1) cnt++;
			x/=2;
		}
		return cnt;
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				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());}
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(double x) {w.println(x);w.flush();}
		void pln(boolean x) {w.println(x);w.flush();}
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void pln(BigInteger x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
		void p(BigInteger x) {w.print(x);w.flush();}
		void p(double x) {w.print(x);w.flush();}
		void p(boolean x) {w.print(x);w.flush();}
	}
}