implemented integer average