/*
TASK:lab101
LANG:C
*/

#include <stdio.h>

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	printf("%d\n", (n + m) % 3);
	return 0;
}
