package main import . "fmt" func main() { var a,b,n,m int64 Scan(&a,&b,&n,&m) if a>b { a,b=b,a n,m=m,n } b-=a x:=b/(m+1) Println(x+a) }