APriCoT: Action Primitives based on Contact-state Transition for In-Hand Tool Manipulation