#include<iostream>
#include<iostream>
using namespace std;

bool isValidPassword(const string&password) {
    bool hasLower=false, hasupper=false, hasDigit=false,hasSpecial=false;
    for(char ch:password) {
        if (ch>='a' && ch<='z')
        hasLower=true;
        else if(ch>='A' && ch<='Z')
        hasupper=true;
        else if(ch>='0' && ch<='9')
        hasDigit=true;
        else if (ch=='$' || ch=='#' || ch=='@') hasSpecial=true;
    }
    return hasLower && hasupper && hasDigit && hasSpecial;
}
int main() {
    string password;
    cin>>password;
    if(isVAlidPassword(password))
    cout<<"Password is valid"<<endl;
    else
    cout<<"Invalid input"<<endl;
}
return 0;
}