import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto N = readln.chomp.to!int;
    auto X = new long[](N);
    auto S = new long[](N);
    foreach (i; 0..N) {
        auto s = readln.split.map!(to!long);
        X[i] = s[0];
        S[i] = s[1];
    }

    long[] Y;
    foreach (i; 0..N) {
        Y ~= S[i];
        if (i < N - 1) Y ~= X[i] - X[i+1];
    }

    long ans = 0;
    long tmp = 0;

    for (int i = 0, j = 0; i < N * 2 - 1; ++i) {
        if (j < i) {
            j = i;
            tmp = 0;
        }
        while (j < N * 2 - 1 && tmp + Y[j] >= 0) {
            tmp += Y[j];
            ++j;
            ans = max(ans, tmp);
        }
    }

    ans.writeln;
}
