import std.stdio; import std.range; import std.array; import std.string; import std.conv; import std.typecons; import std.algorithm; import std.container; import std.typecons; import std.random; import core.time; void main() { auto inputs = readln.chomp.split; auto a = inputs[0].to!int; auto b = inputs[1].to!int; auto op = inputs[2][3]; auto d = map!(to!int) = inputs[2][4..$].split = "."; int dh = d[0]; int dmp; if (d.length > 1) { dmp = d[1]; } else { dmp = 0; } auto f = (int a, int b, char op) { final switch (op) { case '+': return a + b; case '-': return a - b; } }; int nh = f(f(a, 9, '-'), dh, op); int nm = f(b, dmp * 6, op); for (;;) { bool g = false; if (nm >= 60) { ++nh; nm = nm % 60; g |= true; } if (nm < 0) { --nh; nm = (nm + 60) % 60; g |= true; } if (!g) { break; } } nh = (nh + 24 * (1 << 10)) % 24; writefln("%02d:%02d", nh, nm); }