import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string; import std.regex; void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}} void main() { int a, b; string s; readV(a, b, s); auto m = s.matchFirst(r"UTC(\+|-)(\d+)(\.(\d))?"); auto c = m[1], d = m[2].to!int, e = m[4].empty ? 0 : m[4].to!int; a -= 9; if (c == "+") { a += d; b += e*6; } else { a -= d; b -= e*6; } if (b < 0) { b += 60; --a; } if (b > 59) { b -= 60; ++a; } if (a < 0) { a += 24; } if (a > 23) { a -= 24; } writefln("%02d:%02d", a, b); }