Under construction

Still being built. Things may change

Carrying the Bags

Interview

Time limit1sMemory limit1024 MB

Summary
Given K bags, a walking time X, and a per-bag delay Y, find the trip plan that moves all bags to the award table in the least total time.
Level

Medium4 of 10

Topics
Dynamic programming, Math
Solved
No attempts yet

Problem

The olympiad jury asked Kevin to help move KK packed prizes from the jury work room to the award table. Kevin is strong enough to carry any number of bags at once. However, each additional bag takes twice as long to hook onto his arm as the one before it. The first bag takes 1 second, the second takes 2 seconds, the third takes 4 seconds, the fourth takes 8 seconds, and so on.

The bags also slow him down. Without any bags, Kevin needs XX seconds to walk from the jury work room to the award table (or back). Each bag he carries adds YY seconds to that walking time.

Write a program that finds the fastest plan for moving all the bags to the award table. Kevin starts in the jury work room, takes some number of bags, and carries them to the award table. If bags remain, he goes back to the work room for the next load. Once all bags are on the award table, Kevin waits there for the contest to end.

Input

A single line contains the space-separated integers KK, XX, and YY, where KK (1≤K≤2001 \le K \le 200) is the number of prizes in bags, XX (1≤X≤10 0001 \le X \le 10\,000) is the time in seconds to walk between the jury work room and the award table without bags, and YY (1≤Y≤5001 \le Y \le 500) is the number of extra seconds each bag adds to the walking time.

Output

Print the minimum total time TT in seconds for moving all the bags to the award table on the first line.

Print the number of trips NN from the jury work room to the award table on the second line.

Print NN space-separated integers on the third line, giving the number of bags carried on each trip. If several plans reach the minimum time, print any of them.

Examples2

  1. Example 1

    Input
    5 50 10
    
    Expected output
    131
    1
    5
    
  2. Example 2

    Input
    10 50 10
    
    Expected output
    312
    2
    5 5