calculator primitive version