Title Description
The train departs from the starting point (called the 1th Station), the number of passengers arriving at the start of the station is a, then to the 2nd stop, and at the 2nd stop, the number of people on and off the bus is the same, so the number of passengers on the 2nd station (i.e. before arriving at the 3rd station) remains a. From the 3rd station (including the 3rd station), the number of people have a certain regularity: the number of passengers are the first two stations on the number of passengers, and the number of alight is equal to the number of passengers on the last station, until the terminus of the previous station (N-1 station), are satisfied with this law. The conditions are as follows: There are n stations, the number of passengers on the bus is a, and the number of the last stop is M (all get off). What is the number of people on the bus when X station is opened?
Input/output format
Input format:
A (<=20), N (<=20), M (<=2000), and X (<=20),
Output format:
The number of people on the bus from X station.
Input and Output Sample input example # #:
5 7 32 4
Sample # # of output:
13
Code
Unknown 50 points
Logulo P1011 Station Label: Qaq unknown 50 minutes