#include #include #define rep(i,n) for(int i = 0; i < n; i++) #define srep(i,a,b) for(int i = a; i < b; i++) #define all(A) (A).begin(),A.end() #define MOD 1000000007 using namespace std; using ll = long long; using P = pair; using Graph = vector>; int main(void){ string s; cin >> s; string t = "1"; rep(i,100){ t += "3"; if(s == t){ cout << i+1; return 0; } } cout << -1; }