The teacher secretly thought of a three-digit number $S$. Students $A$, $B$, $C$, and $D$ tried to guess the number by suggesting $541$, $837$, $291$, and $846$ respectively. The teacher informed them that each of them got exactly one digit correct, and it was in the correct position. What is the number $S$?

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