\problemname{F1 Racing}
\illustration{0.3}{hondaPitstop}{\href{https://www.flickr.com/photos/65667643@N00/125026340}{CC-BY-2.0, Honda Pit Stop by ariffjamili via Flickr}}%
%
All over Europe the F1-fever is burning stronger then ever after NextFlex released ``Cars go vrooooom.''
Once you get in, there is no way out. The drama, the tactics, the drama, the racing, but most of all the drama. 

This years series is one of the most exciting yet. The legendary battle between the two main stars
 Min Verstopen and Lery Slowington never fails to make a race entertaining. 
 There are mind games, close battles and almost accidents all the way. But above all of this, the winner
of a F1 race is the fastest driver, and the team with the best tactical decisions.

An above average committed fan named Dorothy has noticed that in our modern era of F1 there are numerous
instruments on a F1 car, giving the teams data on how fast each car can 
race in different conditions. %With this in mind Dorothy has decided to start up Optimal Racing.
 Dorothy believes one could use superior knowledge of algorithms to decide the best possible
tactic given a set of race conditions. She has ran some statistics, and found that a car with $x$ round old tires uses $$r + b \cdot x$$
seconds on one lap where $r$ and $b$ are constants depending on the particular track.
% This means a fresh set of tires use $r$ seconds on their first lap.
Now she turns to you to provide her with an algorithm that finds the total race time for a team using optimal pitstops.


\section*{Input}
The input consists of four space-separated integers $n$, $p$, $r$ and $b$.
\begin{itemize}
   \item $1 \leq n \leq 10^9$ denotes the number of laps in the race,
   \item $0 \leq p \leq 10^9$ denotes how long it takes to change tires measured in seconds,
   \item $1 \leq r \leq 100$ denotes how many seconds it takes to race around the track on fresh tires, and
   \item $0 \leq b \leq 4$ denotes the tear factor on the wheels.
\end{itemize}

\section*{Output}
A single integer, the minimum number of seconds required to finish the race.
