#include<iostream>
#include<string>
using namespace std;
int main;()
{
    string password;
    cin>>password;
    bool hasLower = false, hasUpper = false, hasDigit = false, hasSpecial = false;
    string special="$#@";
    if (password. length()<6 || password)
    {
        cout<<"Invalid input"<<endl;
        return 0;
    }
    for (char c: password)
    {
        if (islower(c)) hasUpper = true;
        else if(isupper(c)) hasUpper = true;
        else if(isdigit(c)) hasDigit = true;
        else if(special.find(c)!=string::npos) hasSpecial=true;
    }
    if(hasLower && hasUpper && hasDigit &&  hasSpecial)
    {
        cout<<"Password is valid" <<endl;
    }
    else
    {
        cout<<"Ivalid input" <<endl;
    }
    return 0;
}