convert calculate logic