arith: add average, and max&&min functions