#include using namespace std; int main(){ string s; cin >> s; if(s[s.size()-1] == '3') cout << s.size() - 1 << endl; else cout << -1 << endl; return 0; }