import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.NoSuchElementException; public class Main { public static void main(String[] args) { new Main().run(); } void run() { FastScanner sc=new FastScanner(); int N=sc.nextInt(); int K=sc.nextInt(); char[][] S=new char[N][]; long[] C=new long[N]; int[][] cnt=new int[N][3]; long[] dp=new long[3*K+1]; long INF=Long.MAX_VALUE/3; Arrays.fill(dp, INF); dp[0]=0; char[] target=("J".repeat(K)+"O".repeat(K)+"I".repeat(K)).toCharArray(); char[] JOI= "JOI".toCharArray(); for (int i=0;i