n, p, k = map(int, input().split())
max_ = 10**18 + 1
DP = [[0 for _ in range(k + 1)] for _ in range(n + 1)]
DP[0][0] = p
for i in range(n):
    t, b = map(int, input().split())
    for j in range(min(i + 1, k + 1)):
        DP[i + 1][j] = min(max(DP[i + 1][j], DP[i][j]), max_)
        if j < k:
            if t == 1:
                DP[i + 1][j + 1] = min(max(DP[i + 1][j + 1], DP[i][j] + b), max_)
            else:
                DP[i + 1][j + 1] = min(max(DP[i + 1][j + 1], DP[i][j] * 2), max_)
if DP[n][k] == max_:
    DP[n][k] = -1
print(DP[n][k])