Using all four digits 2,5,5,7 exactly once each, distinct four-digit numbers are formed. Two arrangements that differ only by swapping the two 5s give the same number and are counted once. Let S be the sum of all these distinct four-digit numbers. To find S, count how many times each digit occupies a fixed place, such as the units place. What is the value of S?