var i,k,j,s:integer;
begin
readln(k);
FOR I:=100 TO 300 DO
begin
s:=0;
for j:=1 to i do
if i mod j=0 then s:=s+j;
if s=k then writeln(i);
end;
end.
//Я сделаль
#include <bits/stdc++.h>
using namespace std;
int main()
{
cout << " 1 \n";
cout << "------\n";
cout << " M \n";
cout << " MMM \n";
cout << "MMMMM\n";
cout << " M M \n";
cout << " MMM \n";
cout << "------\n";
cout << " 2 \n";
cout << "------\n";
cout << "M \n";
cout << "MM \n";
cout << "MMMMMM\n";
cout << " MM\n";
cout << " M\n";
cout << "------\n";
cout << " 3 \n";
cout << "------\n";
cout << "M M\n";
cout << " M M \n";
cout << " MMMMM \n";
cout << " M M M \n";
cout << " MMMMM \n";
cout << "------\n";
cout << " 4 \n";
cout << "------\n";
cout << " M\n";
cout << " MM\n";
cout << " MMM\n";
cout << " MMMMM\n";
cout << "MMMMMMM\n";
cout << "------\n";
cout << " 5 \n";
cout << "------\n";
cout << "M M\n";
cout << "MM MM\n";
cout << "MMMMM\n";
cout << "MM MM\n";
cout << "M M\n";
}