Input parsing and cost function.

Added simple code for parsing input and implemented draft of cost
function.