{"task": {"agent_timeout": 600, "task": "810", "verifier_timeout": 7200, "instruction": "Please implement a Python 3 solution to the below problem.\nReason through the problem and:\n1. Restate the problem in plain English\n2. Conceptualize a solution first in plain English\n3. Write a pseudocode solution\n4. Save your solution as solution.py\nNo outside libraries are allowed.\n\n[BEGIN PROBLEM]\nFarmer John and his personal trainer Bessie are hiking up Mount Vancowver. For\ntheir purposes (and yours), the mountain can be represented as a long straight\ntrail of length $L$ meters ($1 \\leq L \\leq 10^6$). Farmer John will hike the\ntrail at a constant travel rate of $r_F$ seconds per meter\n($1 \\leq r_F \\leq 10^6$). Since he is working on his stamina, he will not take\nany rest stops along the way.\n\nBessie, however, is allowed to take rest stops, where she might find some tasty\ngrass. Of course, she cannot stop just anywhere! There are $N$ rest stops along\nthe trail ($1 \\leq N \\leq 10^5$); the $i$-th stop is $x_i$ meters from the start\nof the trail ($0 < x_i < L$) and has a tastiness value $c_i$\n($1 \\leq c_i \\leq 10^6$). If Bessie rests at stop $i$ for $t$ seconds, she\nreceives $c_i \\cdot t$ tastiness units.\n\nWhen not at a rest stop, Bessie will be hiking at a fixed travel rate of $r_B$\nseconds per meter ($1 \\leq r_B \\leq 10^6$). Since Bessie is young and fit, $r_B$\nis strictly less than $r_F$.\n\nBessie would like to maximize her consumption of tasty grass. But she is worried\nabout Farmer John; she thinks that if at any point along the hike she is behind\nFarmer John on the trail, he might lose all motivation to continue!\n\nHelp Bessie find the maximum total tastiness units she can obtain while making\nsure that Farmer John completes the hike.\n\nINPUT FORMAT:\nThe first line of input contains four integers: $L$, $N$, $r_F$, and $r_B$. The\nnext $N$ lines describe the rest stops. For each $i$ between $1$ and $N$, the\n$i+1$-st line contains two integers $x_i$ and $c_i$, describing the position of\nthe $i$-th rest stop and the tastiness of the grass there.\n\nIt is guaranteed that $r_F > r_B$, and $0 < x_1 < \\dots < x_N < L $.  Note\nthat $r_F$ and $r_B$ are given in seconds per meter! \n\nOUTPUT FORMAT:\nA single integer: the maximum total tastiness units Bessie can obtain.\n\nSAMPLE INPUT:\n10 2 4 3\n7 2\n8 1\nSAMPLE OUTPUT: \n15\n\nIn this example, it is optimal for Bessie to stop for $7$ seconds at the $x=7$ rest stop (acquiring $14$ tastiness units) and then stop for an additional $1$ second at the $x=8$ rest stop (acquiring $1$ more tastiness unit, for a total of $15$ tastiness units).\n\n\nProblem credits: Dhruv Rohatgi\n\n[END PROBLEM]\n", "memory": "2048m", "runnable": false, "difficulty": "medium", "language": "", "cpus": 1, "instruction_truncated": false, "category": "python_programming", "compose": false, "has_solution": true, "oracle": null, "docker_image": "", "taskset": "usaco", "tags": ["python", "programming", "usaco"]}, "runs": []}