#include <iostream>
#include <vector>
typedef unsigned char byte;
byte calc_iv(std::vector<byte> buffer)
{
int iv = 0;
for(int i = 0; i < buffer.size(); i++) {
byte I = buffer[i];
iv += I;
iv *= I + 1;
}
return iv / buffer.size();
}
int main(){
std::vector<byte> buf = {41, 32, 16};
byte iv = calc_iv(buf);
std::cout<<(int)iv<<std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdHlwZWRlZiB1bnNpZ25lZCBjaGFyIGJ5dGU7CgpieXRlIGNhbGNfaXYoc3RkOjp2ZWN0b3I8Ynl0ZT4gYnVmZmVyKQp7CiAgICBpbnQgaXYgPSAwOwogICAgZm9yKGludCBpID0gMDsgaSA8IGJ1ZmZlci5zaXplKCk7IGkrKykgewogICAgICAgIGJ5dGUgSSA9IGJ1ZmZlcltpXTsKICAgICAgICBpdiArPSBJOwogICAgICAgIGl2ICo9IEkgKyAxOwogICAgfQogICAgcmV0dXJuIGl2IC8gYnVmZmVyLnNpemUoKTsKfQoKCmludCBtYWluKCl7CiAgICBzdGQ6OnZlY3RvcjxieXRlPiBidWYgPSB7NDEsIDMyLCAxNn07CiAgICBieXRlIGl2ID0gY2FsY19pdihidWYpOwogICAgc3RkOjpjb3V0PDwoaW50KWl2PDxzdGQ6OmVuZGw7CgogICAgcmV0dXJuIDA7Cn0K