#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cout.tie(0);
int n;
cin>>n;
set<int> st;
int sum=1;
st.insert(1);
for(int i=2;i<=sqrt(n);i++)
{
if(n%i==0)
{
if(i==sqrt(n))//防n^2
sum+=i;
else
sum+=i+n/i;
st.insert(i);
st.insert(n/i);
}
}
cout<<"再抄 被抓到了喔“<<endl;
int sum1=1;
set<int>stt;
if(sum!=1)
{
stt.insert(1);
for(int i=2;i<=sqrt(sum);i++)
{
if(sum%i==0)
{
if(i==sqrt(sum))
sum1+=i;
else
sum1+=i+sum/i;
stt.insert(i);
stt.insert(sum/i);
}
}
}
auto it=st.begin();
cout<<*it;
for(it++;it!=st.end();it++)
{
cout<<"+"<<*it;
}
cout<<"="<<sum<<endl;
if(sum==n)
{
cout<<n<<" is perfect."<<endl;
}
else if(sum==1)
{
cout<<"=0"<<endl;
cout<<n<<" has no friends.";
}
else
{
auto itt=stt.begin();
if(sum!=0)
cout<<*itt;
for(itt++;itt!=stt.end();itt++)
cout<<"+"<<*itt;
cout<<"="<<sum1<<endl;
if(sum1==n)
cout<<n<<" and "<<sum<<" are friends.";
else
cout<<n<<" has no friends.";
}
return 0;
}