UVa 514: Rails

Accepted