main=interact$show.f.map read.words;f[d,a,b]=minimum[x*a+d*b-x*b|x<-[0..d]]