j,m,d,y=map(float,input().split())
if m==11:
    if d==11:
        if y==1:
            j=j*0.7-50
        else:
            j=j*0.7
else:
    if m==12:
        if d==12:
            if y==1:
                j=j*0.8-50
            else:
                j=j*0.8
if j <= 0:
    print('0.00')
else:
    print(f'{j:.2f}')