inf = open("conquest.in", "r")
ouf = open("conquest.out", "w")

n = int(inf.readline())
c = []
total = 0
for i in range(n):
    ca, cc = map(int, inf.readline().split())
    c.append((ca, cc))
    total += ca
c.sort()

prefsum = [0] * (n + 1)
for i in range(n):
    prefsum[i + 1] = prefsum[i] + c[i][0]

INF = 1000000000;
MAX = 100;
d = [[INF] * (MAX + 2) for i in range(n + 1)]

d[0] = [0] * (MAX + 2)

for i in range(n):
    for j in range(len(d[i])):
        if d[i][j] != INF:
            k = 0
            while k <= c[i][0] and k <= j:
                cost = k * c[i][1];
                count = prefsum[i] + j;
                if count > c[i][0] - k and d[i][j] + cost < d[i + 1][j - k]:
                    d[i + 1][j - k] = d[i][j] + cost;
                k += 1

print(d[n][0], file = ouf)

