<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def digit(m: Union[int, pd.Series], n: int) -> Union[int, pd.Series]: """Returns the nth digit of each number in m."""

        return (m // (10 ** n)) % 10