read n k
H=$((n - 2))
ans=0
chk=0

for i in `seq 2 6`
do
	chk=$(( ((i * 3) + 21) * 3 ))
	for x in `seq $H`
	do
		if [ $((chk % 11)) -eq $k ]
		then
			ans=$((ans + 1))
		fi
		chk=$((chk + 63))
	done
done
echo $ans
