public class Main { public static void main(String[] args) { int i, a, b, c, flag = 0; for ( i = 100; i < 1000; i++) { a = i/100; b = (i-100*a)/10; c = i%10; if(i==a*a*a+b*b*b+c*c*c) { if(flag==1) { System.out.print(","); System.out.print(i); } else { System.out.print(i); flag = 1; } } } } }