import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string; import std.regex; auto rdsp(){return readln.splitter;} void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;} void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);} 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); }