• + 0 comments
    from datetime import datetime
    def fine(returned,due):
        if int(returned[2])<1000:
            returned[2] = returned[2].zfill(4)
        if int(due[2])<1000:
            due[2] = due[2].zfill(4)
        
        due = datetime.strptime(" ".join(due),"%d %m %Y").date()
        returned = datetime.strptime(" ".join(returned),"%d %m %Y").date()
        if returned > due:
           if returned.year > due.year:
               return 10000
           if returned.month > due.month:
    
               return 500*(returned.month - due.month)
           if returned.day > due.day:
               return 15 * (returned.day - due.day)
        else:
           return 0
           
    print(fine(input().split(" "),input().split(" ")))