package no324; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); if (m <= 1) { System.out.println(0); return; } int[] w = new int[n]; for(int i=0;i" + fir + "," + 1 + "," + (i+1) + "," + (j+1) + ":" + nj); dp[fir][1][i+1][j+1] = Math.max(dp[fir][1][i+1][j+1], nj); } //取らない dp[fir][0][i+1][j] = Math.max(dp[fir][0][i+1][j], dp[fir][bef][i][j]); // System.out.println(fir + "," + bef + "," + i + "," + j + ":" + dp[fir][bef][i][j] + "->" + fir + "," + 0 + "," + (i+1) + "," + j + ":" + dp[fir][bef][i][j]); } } } } int ans = Integer.MIN_VALUE; for(int fir=0;fir<2;fir++) { for(int bef=0;bef<2;bef++) { ans = Math.max(ans, dp[fir][bef][n-1][m]); } } System.out.println(ans); } }