{"raw_statement":[{"iden":"problem statement","content":"Takahashi is at an all-you-can-eat restaurant.\nThe restaurant offers $N$ kinds of dishes. It takes $A_i$ minutes to eat the $i$\\-th dish, whose deliciousness is $B_i$.\nThe restaurant has the following rules:\n\n*   You can only order one dish at a time. The dish ordered will be immediately served and ready to eat.\n*   You cannot order the same kind of dish more than once.\n*   Until you finish eating the dish already served, you cannot order a new dish.\n*   After $T-0.5$ minutes from the first order, you can no longer place a new order, but you can continue eating the dish already served.\n\nLet Takahashi's happiness be the sum of the deliciousness of the dishes he eats in this restaurant.\nWhat is the maximum possible happiness achieved by making optimal choices?"},{"iden":"constraints","content":"*   $2 \\leq N \\leq 3000$\n*   $1 \\leq T \\leq 3000$\n*   $1 \\leq A_i \\leq 3000$\n*   $1 \\leq B_i \\leq 3000$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $T$\n$A_1$ $B_1$\n$:$\n$A_N$ $B_N$"},{"iden":"sample input 1","content":"2 60\n10 10\n100 100"},{"iden":"sample output 1","content":"110\n\nBy ordering the first and second dishes in this order, Takahashi's happiness will be $110$.\nNote that, if we manage to order a dish in time, we can spend any amount of time to eat it."},{"iden":"sample input 2","content":"3 60\n10 10\n10 20\n10 30"},{"iden":"sample output 2","content":"60\n\nTakahashi can eat all the dishes within $60$ minutes."},{"iden":"sample input 3","content":"3 60\n30 10\n30 20\n30 30"},{"iden":"sample output 3","content":"50\n\nBy ordering the second and third dishes in this order, Takahashi's happiness will be $50$.\nWe cannot order three dishes, in whatever order we place them."},{"iden":"sample input 4","content":"10 100\n15 23\n20 18\n13 17\n24 12\n18 29\n19 27\n23 21\n18 20\n27 15\n22 25"},{"iden":"sample output 4","content":"145"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}