#include <stdio.h>


int three_equal_consecutive_digits(int n, int b);


int main() {
  int n, b;
  while (scanf("%d %d", &n, &b) > 0)
    printf("%d %d %d\n", n, b, three_equal_consecutive_digits(n, b)? 1 : 0);
}
