separate the last digit and sort according to the group and sum https://www.mediafire.com/file/uzw5kjjas1lxfmz/3+padroes.xlsx/file