Changed 'mid' to 'med', to became compliant with the problem description...

....