Program my microwave oven I'm very lazy so I try to always program my microwave with the fewest possible button presses.  My microwave has the following buttons:


A "minute plus" button which may only be pressed first and implies "start".  It may be pressed multiple times for multiple minutes, but it will not add a minute to a manually entered time.  Output +
A set of 0-9 buttons.  Time entry is MMSS (i.e. "130" means 1 minute 30 seconds).  Seconds may range from 0..99.  So "130" and "90" are equivalent entries.  Obviously each minute is 60 seconds even if the seconds part of the entry exceeds 59.  Output 0..9
A "start" button which must be pressed to start the microwave if the time is entered manually.  Output S


My food packages specify time in MM:SS and so the program must accept that input.

Examples


1:00 is + (remember "minute plus" implies start)
1:01 is 61S (seconds can exceed 59, but "minute plus" does not work in conjunction with digits -- I think this is a design flaw in my microwave)
9:00 is 900S (shorter than +++++++++)
JavaScript

var x = /(\d+):(\d\d)/.exec('&lt;time here&gt;');
x[1] === '0' ? +x[2] + 'S' :
x[1] &lt; 4 &amp;&amp; x[2] === '00' ? (
    x[1] === '1' ? '+' :
    x[1] === '2' ? '++' : '+++') :
x[2] &lt; 40 ?
    (x[1] - 1 ? x[1] - 1 : '') + '' + (6 + +x[2][0]) + x[2][1] + 'S' :
x[1] + x[2] + 'S'