package main import ( "fmt" "math" ) func main() { var a, b, c, d, e int fmt.Scan(&a, &b, &c, &d, &e) fmt.Println(a-b+c*int(math.Max(float64(d-e), 0))) }