#include int main() { int a, b; scanf("%d%d",&a,&b); for (;;) if ((a += 4) % 12 != b)break; printf("%d",a);; }