adding algorithm uniform in D