#include <iostream>
int average(int* total, int* count);
int main()
{
int total[1];
int temp[1];
int count[1];
*total = 0;
*count = 0;
std::cin >> *temp;
while (*temp >= 0)
{
*total += *temp;
++(*count);
std::cin >> *temp;
}
std::cout << average(total, count) << std::endl;
return 0;
}
int average(int* total, int* count)
{
if (*count != 0)
{
return (*total)/(*count);
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IGF2ZXJhZ2UoaW50KiB0b3RhbCwgaW50KiBjb3VudCk7CgppbnQgbWFpbigpCnsKICAgIGludCB0b3RhbFsxXTsKICAgIGludCB0ZW1wWzFdOwogICAgaW50IGNvdW50WzFdOwogICAgKnRvdGFsID0gMDsKICAgICpjb3VudCA9IDA7CiAgICBzdGQ6OmNpbiA+PiAqdGVtcDsKICAgIHdoaWxlICgqdGVtcCA+PSAwKQogICAgewogICAgICAgICp0b3RhbCArPSAqdGVtcDsKICAgICAgICArKygqY291bnQpOwogICAgICAgIHN0ZDo6Y2luID4+ICp0ZW1wOwogICAgfQogICAgc3RkOjpjb3V0IDw8IGF2ZXJhZ2UodG90YWwsIGNvdW50KSA8PCBzdGQ6OmVuZGw7CiAgICByZXR1cm4gMDsKfQoKaW50IGF2ZXJhZ2UoaW50KiB0b3RhbCwgaW50KiBjb3VudCkKewogICAgaWYgKCpjb3VudCAhPSAwKQogICAgewogICAgICAgIHJldHVybiAoKnRvdGFsKS8oKmNvdW50KTsKICAgIH0KICAgIHJldHVybiAwOwp9