// editor5
#include<iostream>
#include<string>
#include<cctype>
bool validatePassword(const string password)
{
    if(password.length() !=10)
    {
        return false;
    }
    bool hasLower=false;
    bool hasUpper=false;
    bool hasDigit=false;
    bool hasSpecial=false;
    
    for(char c : password)
    {
        if(islower(c))
        {
            hasLower=true;
        }
        else if(isupper(c))
        {
            hasUpper=true;
        }
        else if(isdigit(c))
        {
            hasDigit=true;
        }
        else if(c=='$'||c=='#'||c=='@')
        {
            hasSpecial=true;
        }
    }
    return hasLower && hasUpper &&hasDigit &&hasSpecial;
}
int main()
{
    string password;
    cin>>password;
    if(validatePassword(password))
    {
        cout<<"Password is valid"<<endl;
    }
    else
    {
        cout<<"Invalid input"<<endl;
    }
}
return 0;
}