John and Mary each select a natural number and tell them to Bill. Bill writes down their sum and product on two separate pieces of paper, hides one, and shows the other to John and Mary. John looks at the number, which is $2002$, and declares he cannot determine Mary's number. Knowing this, Mary also says she cannot determine John's number. What was Mary's number?

Let's think step by step and output the final answer within \boxed{}.
user