#include<stdio.h>
#include<math.h>
int main()
{
	int n, digit, i=0, sum= 0;
	scanf("%d", &n);
	while(n>0)
	{
		digit = n % 10;
		i++;
		int j = i-1;
		if(digit%2==i%2)
		{
			sum += pow(2,j);
		}
		n /= 10;
	}
	printf("%d", sum);
	
	return 0;
}