last homework caclutor. TODO validate input