{"problem":{"name":"Hands","description":{"content":"There are two $100$\\-story buildings, called `A` and `B`. (In this problem, the ground floor is called the first floor.) For each $i = 1,\\dots, 100$, the $i$\\-th floor of `A` and that of `B` are conne","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc109_a"},"statements":[{"statement_type":"Markdown","content":"There are two $100$\\-story buildings, called `A` and `B`. (In this problem, the ground floor is called the first floor.)\nFor each $i = 1,\\dots, 100$, the $i$\\-th floor of `A` and that of `B` are connected by a corridor. Also, for each $i = 1,\\dots, 99$, there is a corridor that connects the $(i+1)$\\-th floor of `A` and the $i$\\-th floor of `B`. You can traverse each of those corridors in both directions, and it takes you $x$ minutes to get to the other end.\nAdditionally, both of the buildings have staircases. For each $i = 1,\\dots, 99$, a staircase connects the $i$\\-th and $(i+1)$\\-th floors of a building, and you need $y$ minutes to get to an adjacent floor by taking the stairs.\nFind the minimum time needed to reach the $b$\\-th floor of `B` from the $a$\\-th floor of `A`.\n\n## Constraints\n\n*   $1 \\leq a,b,x,y \\leq 100$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$a$ $b$ $x$ $y$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc109_a","tags":[],"sample_group":[["2 1 1 5","1\n\nThere is a corridor that directly connects the $2$\\-nd floor of `A` and the $1$\\-st floor of `B`, so you can travel between them in $1$ minute. This is the fastest way to get there, since taking the stairs just once costs you $5$ minutes."],["1 2 100 1","101\n\nFor example, if you take the stairs to get to the $2$\\-nd floor of `A` and then use the corridor to reach the $2$\\-nd floor of `B`, you can get there in $1+100=101$ minutes."],["1 100 1 100","199\n\nUsing just corridors to travel is the fastest way to get there."]],"created_at":"2026-03-03 11:01:13"}}