#include main(int n){int s=0;for(;;){scanf("%d",&n);s+=n;if(n==1134||n==1133||n==8)break;}printf("%d",s);}