#include <iostream>
struct volume
{
int lit ;
int ml ;
};
volume operator+ ( volume a, volume b )
{
const int ml = a.ml + b.ml ;
return { a.lit + b.lit + ml/1000, ml%1000 } ;
}
std::ostream& operator<< ( std::ostream& stm, volume vol )
{ return stm << "( " << vol.lit << "L " << vol.ml << "ml )" ; }
int main()
{
volume a { 12, 650 } ;
volume b { 29, 723 } ;
std::cout << a << " + " << b << " == " << a+b << '\n' ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IHZvbHVtZQp7CiAgICBpbnQgbGl0IDsKICAgIGludCBtbCA7Cn07Cgp2b2x1bWUgb3BlcmF0b3IrICggdm9sdW1lIGEsIHZvbHVtZSBiICkKewogICAgY29uc3QgaW50IG1sID0gYS5tbCArIGIubWwgOwogICAgcmV0dXJuIHsgYS5saXQgKyBiLmxpdCArIG1sLzEwMDAsIG1sJTEwMDAgfSA7Cn0KCnN0ZDo6b3N0cmVhbSYgb3BlcmF0b3I8PCAoIHN0ZDo6b3N0cmVhbSYgc3RtLCB2b2x1bWUgdm9sICkKeyByZXR1cm4gc3RtIDw8ICIoICIgPDwgdm9sLmxpdCA8PCAiTCAiIDw8IHZvbC5tbCA8PCAibWwgKSIgOyB9CgoKaW50IG1haW4oKQp7CiAgICAgIHZvbHVtZSBhIHsgMTIsIDY1MCB9IDsKICAgICAgdm9sdW1lIGIgeyAyOSwgNzIzIH0gOwogICAgICBzdGQ6OmNvdXQgPDwgYSA8PCAiICsgIiA8PCBiIDw8ICIgPT0gIiA8PCBhK2IgPDwgJ1xuJyA7Cn0K