You can actually write it quite literally in scala:
(0 to 3).map { n =>
list.collect { case (x, `n`) => x }.sum
}
Note the "backticks" around n in the case clause. This means "match only tuples where second element equals to n". Without backticks in this context, it would mean "create a new local variable n, and assigned the second element of the tuple to it".
Alternatively, with a little more effort, you could compute all four sums in one pass through the list (which could save you some time, if there were, say, thousand of sums, rather than four, and the list had a few million elements in it):
list.foldLeft(Map.empty[Int, Double]) { case (result, (value, n)) =>
result + (n -> (result.getOrElse(n, 0.0) + value))
}.toSeq
.sortBy(_._1)
.map(_._2)
This goes through the list, summing up values, and accumulating the result in a map, keyed by the second element of the tuple.
Then convert the resulting map to a sequence of tuples, sort it by key, and then drop it, returning just a Seq of sums.