Four different digits are given. We use each of them exactly once to construct the largest possible four-digit number. We also use each of them exactly once to construct the smallest possible four-digit number which does not start with \(0\). If the sum of these two numbers is \(10477\), what are the given digits?