calc summ and remainder