full average function