Calculate the points in a "sjoelen"-game Okay, so yesterday was 2nd Christmas day and my (grand)parents and me had a game of "sjoelen", as it is called in the Netherlands. The inner programmer came up in me, but just when I had the answer, I lost it. I want you to remake it.

The rules:

You have a wooden plank, a sjoelbak, with 4 boxes, each with their own number. When a schijf (A puck-like object) goes in one of the boxes you get the points above that box.


When there is a schijf in all 4 of the boxes, you don't get 10 but you get 20 points.

Example:

From left to right: 3 5 4 3
Each box has at least 3 schijven (Plural of schijf) so that is 20 * 3 = 60 points.

Resulting values: 0 2 1 0
0*2 + 2*3 + 1*4 + 0*1 = 10 points.

Which makes a total of 60+10 = 70 points.

The input:
The amount of schijven from left to right, ie "4 5 4 5", [4,5,4,5], "4\n5\n4\n5", whatever you like.

The output:
The amount of points, ie 84, as output, variable, return or on top of the stack, whatever you like.

As in each and every code golf, you can not use external scripts and the code with the least bytes wins.

PS: As you may have already noticed, I'm Dutch. Feel free to edit possible grammar mistakes.
CJam, 23 21 20 bytes
q~_$0=f+1m&gt;{X):X*+}*

I might be able to golf a couple of bytes off this.
Input is like
[3 5 4 3]

Output is the score
70

How it works
q~                         &quot;Read the input and evaluate into an array&quot;;
  _$0=                     &quot;Copy the array, sort it and get the minimum number&quot;;
                           &quot;This minimum is the number of common schijven&quot;;
      f+                   &quot;Increment each of the schijven by the common schijven number&quot;; 
        1m&gt;                &quot;Take 1 element from the end of the array and put&quot;;
                           &quot;it in the beginning&quot;;
           {      }*       &quot;Reduce the elements of the array based on this block&quot;;
            X):X           &quot;Increment and update the value of X (initially 1)&quot;;
                *          &quot;Multiply the number of schijven with X&quot;;
                 +         &quot;Add it to current score&quot;;

Algorithm

Since I have right shifted the number of schijven, the score order now becomes [1 2 3 4].
Moreover, using the fact that 1 + 2 + 3 + 4 = 10, I simply add the minimum common schijven to each one to get the effect of bonus 10 score.
Now when I reduce, I get 2 elements initially on stack, the first one, which I ignore is the one with a score of 1 each, then I multiply the second one with 2 and add it to first. In the next iteration, I get the current sum and score 3 schijven. And so on.

Try it online here