https://www.acmicpc.net/problem/2455
import java.util.*
import java.lang.String.format
fun main(args: Array<String>) {
val s=Scanner(System.`in`)
var sum=0
var max=0
for(i in 0 until 4){
var a=s.nextInt()
var b=s.nextInt()
sum+=-a+b
if(sum>=max) max=sum
}
print(max)
}