PUMaC 2017 Team Problem 7

2017 voters vote by submitting a ranking of the integers \{1,2, \ldots, 38\} from favorite (a vote for that value in $1$st place) to least favorite (a vote for that value in $38$th/last place). Let a_{k} be the integer that received the most $k$th place votes (the smallest such integer if there is a tie). Find the maximum possible value of \sum_{k=1}^{38} a_{k}.