#include //armstrong number
#include
using namespace std;
int main() {
int n1,n2;
cin>>n1>>n2;
int rem,rem1;
int sum=0;
int count=0;
for (int i=n1;i<=n2;i++){
int num=i;
int num1=i;
while(num!=0){
rem1=num%10;
count++;
num/=10;
}
while(num1!=0)
{
rem=num1%10;
sum+=pow(rem,count);
num1/=10;}
if(sum==i){
cout<<i<<endl;
cout<<count<<endl<<sum;
}
}
return 0;
}