KAMIL! jumping from 57 to 53 to 46!
Okay this is what made me happy about ruby -
this made me happier :) to 53 bytes
i just remembered that Ruby is object oriented to the core!
and some common syntax sense made it shrink to 48 bytes :))
Still i know there is a shorter solution... that's the beauty of spoj.
The day ends in world rank of 1900 and 1.4 points. :)