#include <iostream>
template <class T>
struct sum
{
T val;
sum(T a) : val(a) {}
template <class T2>
auto operator()(T2 a) -> sum<decltype(val + a)> { return val + a; }
//sum operator()(T a) { return val + a; }
operator T() { return val; }
};
template <class T>
sum<T> f(T a)
{
return a;
}
int main()
{
std::cout << f(1)(2.5)(3.1f)(4) << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdGVtcGxhdGUgPGNsYXNzIFQ+CnN0cnVjdCBzdW0gCnsKCVQgdmFsOwoJc3VtKFQgYSkgOiB2YWwoYSkge30KCQoJdGVtcGxhdGUgPGNsYXNzIFQyPgoJYXV0byBvcGVyYXRvcigpKFQyIGEpIC0+IHN1bTxkZWNsdHlwZSh2YWwgKyBhKT4geyByZXR1cm4gdmFsICsgYTsgfQoKCS8vc3VtIG9wZXJhdG9yKCkoVCBhKSB7IHJldHVybiB2YWwgKyBhOyB9CgkKCW9wZXJhdG9yIFQoKSB7IHJldHVybiB2YWw7IH0KfTsKCnRlbXBsYXRlIDxjbGFzcyBUPgpzdW08VD4gZihUIGEpCnsKCXJldHVybiBhOwp9CgppbnQgbWFpbigpCnsKCXN0ZDo6Y291dCA8PCBmKDEpKDIuNSkoMy4xZikoNCkgPDwgc3RkOjplbmRsOwp9