<>; print+(1,2,5,6,5,6,7,0,1,0)[$_%10],$/for<>;