# -*- coding:utf-8 -*- import sys def tofloat(l): for i in range(len(l)): l[i]=float(l[i]) return l class Balls: def s(self,n): val=0 while n>0: val=val+n n=n/2 val=val+n return val def calcDistance(self, A, B, C, D): t=self.s(A)+self.s(B)+self.s(C)+self.s(D) return t b=Balls() data=sys.stdin.readlines() for item in data: item=item.split(",") item=tofloat(item) result=b.calcDistance(item[0],item[1],item[2],item[3]) if float(int(result))!=result: result=int(result)+1 print(result) else: print(int(result))