main(a){for(;gets(&a);)printf("digital_root(%s)=%d\n",&a,~-atoi()%9+1);}