implement advanced digit calculator