import std.experimental.all; T read(T)() { return readln.chomp.to!T; } T[] reads(T)() { return readln.split.to!(T[]); } alias readint = read!int; alias readints = reads!int; int calc(int a, int b) { int x = (a + 2 * b) / 3; int y = (2 * a + b - 1) / 3; return x - y; } void main() { auto ab = readints; int a = ab[0], b = ab[1]; auto ans = calc(a, b); writeln(ans); }