fun read() = TextIO.scanStream (Int.scan StringCvt.DEC) TextIO.stdIn;
fun readline() = TextIO.inputLine TextIO.stdIn;
fun printint(n) = print(Int.toString n);
val SOME x = read();
val SOME a = read();
val k = (a*3)+x;
fun f(n) = if n<2 then 0 else 1+f(n-2);
val ans = f(k);
printint(ans);
