package com.thinker.saima;

import java.util.Scanner;

public class GongJiaoChe{

	private static int num = 0;
	private static int max = 0;
	private static void cal(String[] strs){
		int diff = Integer.parseInt(strs[1]) - Integer.parseInt(strs[0]);
		num += diff;
		if(max < num) max = num;

	}
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		for(int i=0;i<n;i++){
			String[] tmp = sc.nextLine().split(" ");
			cal(tmp);
		}
		System.out.println(max);
	}
}
