got solve working, done with erlang