let () = Scanf.scanf "%d\n" @@ fun n ->
  Printf.printf "%d\n" @@ Array.fold_left (fun acc (a, b) ->
    acc + if a < b then b else 0) 0 @@
  Array.init n @@ fun _ -> Scanf.scanf "%d %d\n" @@ fun a b -> a, b
