#include <stdio.h>
int main(void) { int n, i; int a, b, c, d, e, f; int count = 0; scanf("%d", &n); for (i = 10000; i < 999999; i++) { a = i / 100000; b = i % 100000 / 10000; c = i % 10000 / 1000; d = i % 1000 / 100; e = i % 100 / 10; f = i % 10; if (a + b + c + d + e + f == n) { if ((a == 0 && b == f && c == e) || (a != 0 && a == f && b == e && c == d)) { count++; printf("%d\n", i); } } } if (count == 0) puts("-1"); return 0; }
|