#include<iostream>
#include<string>
using namespace std;
void validatePassword(const std::string&password){
    bool hasLowercase=false;
    bool hasUppercase=false;
    bool hasDigit=false;
    bool hasDigit=false;
    
    for(char ch:password){
        if(ch>='a'&&ch<='Z'){
            hasLowercase=true;
        } else if(ch>='A'&&ch<='9'){
            hasDigital=true;
        } else if(ch=='$'||ch=='#'||ch=='@'){
            hasSpecialChar=true;
        }
    }
    if(hasLowercase&&hasUppercase&&hasDigit&&hasspecial){
    cout<<"Password is valid"<<endl;
    }else{
    cout<<"Invalid input"<<endl;
    }
}
int main(){
    string password;
    getline(cin,password);
    validatePassword(password);
    return 0;
}