Yahtzee is a game played with five six-sided dice and a score sheet with thirteen different boxes to fill a score in. Each box has its own scoring rules:
- 1s, 2s, 3s, 4s, 5s, 6s all score points equal to the sum of the respective dice (that is, a roll of [3, 2, 3, 1, 5] scored as 3s would be awarded 6 points: 3 for each 3).
- 3-of-a-kind and 4-of-a-kind (as they sound, three or four dice rolled the same) score points equal to the sum of all five dice.
- Full house (two dice show one value, the other three show another) scores 25 points
- Small straight (four consecutive values) scores 30 points
- Large straight (all consecutive values) scores 40 points
- Yahtzee (all dice show the same value) scores 50 points
The thirteenth (chance) makes sense in-game, but not so much for this challenge; additionally the game has bonuses for extra Yahtzees which make no sense here. Because the challenge is...
Given five dice as input (five integers 1-6, input however is convenient, you can assume input is always valid), output the highest score possible for that 'hand'. For the purposes of this challenge, only the scoring methods in the list above are valid (specifically, chance is not a valid score box for this challenge). The score should be output as its decimal numeric value, whether that's an integer or a string representation thereof, whatever. It should be immediately recognizable as a number. Leading/trailing whitespace is fine, this is about getting the score and not presentation.
Code golf, so the answer with the fewest bytes in a given language wins. Standard loopholes forbidden.
Test cases
(Note that these are all independent, the challenge is to score one 'hand' of dice):
in: 1 5 4 3 2
out: 40
in: 1 1 4 3 1
out: 10
in: 2 2 6 5 3
out: 6
in: 2 4 2 4 6
out: 8
in: 1 1 1 1 1
out: 50
in: 5 2 5 3 6
out: 10
in: 1 6 3 4 2
out: 30
in: 1 3 1 1 3
out: 25
in: 6 5 5 6 6
out: 28
in: 1 2 3 5 6
out: 6