Method B for handwritten digit recognition