python 70分
nums=list(map(int,input().split(" ")))
n=nums[0]
m=nums[1]
k=nums[2]
arr=[[i for i in map(int,input().split(" "))]for j in range(n)]
ni=[]
for i in arr:
ni.append(i[0])
ci=[]
for i in arr:
ci.append(i[1])
sums=0
for i in range(n):
sums+=ci[i]*(ni[i]-k)
if m>=sums:
print(k)
else:
ni_min=min(ni)
while m>0:
ni_1=ni.index(max(ni))
m-=ci[ni_1]
ni[ni_1]=ni[ni_1]-1
if max(ni)==ni_min:
break
if m<sum(ci):
print(max(ni))
else:
s=m//sum(ci)
print(max(ni)-s)