#include<bits/stdc++.h>
using namespace std;
int my_atoi(const char* str)
{
bool sign = false;
int total = 0, i = 0;
if(str[0] == '-')
{
sign = true;
i=1;
}
while(str[i]!='\0')
{
total=total*10 + (str[i]-'0');
i++;
}
return (sign == true)?-total:total;
}
int main()
{
const char* str ="-12345";
cout<<my_atoi(str)<<"\n";
return 0;
}