#include<iostream>
#include<cctype>
using namespace std;
int main()
{
    string password;
    cin>>password;
    bool hasLower=false,hasUpper=false,hasDigit,hasSpecial=false;
    string specialchars="$#@";
    for (char ch : password)
    {
        if(isLower(ch))hasLower =true;
        else if(isupper(ch))hasUpper=true;
        else if(isdigit(ch))hasDigit=true;
        else if(specialchars,find(ch)!=string::npos)hasSpecial=true;
    }
    if (hasLower&&hasUpper&&hasDigit&&hasspecial)
    cout<<"Password is valid";
    else
    cout<<"Invalid input";
    return 0;
}