package Greedy; import java.util.*; import java.io.*; /* * @author -- rajatgoyal715 */ public class GreedyFlorist { public static void main( String args[] ){ Scanner in = new Scanner(System.in); int N, K; N = in.nextInt(); K = in.nextInt(); int C[] = new int[N]; for(int i=0; i=0;i--){ result = result + x*C[i]; j++; if(j==K){ x++; j=0; } } System.out.println( result ); } }