add binary sum function