#include <bits/stdc++.h> using namespace std; int main(){ int n,g,s,b,q,w; cin>>n; w = n / 10000; q = n / 1000 % 10; b = n / 100 % 10; s = n / 10 % 10; g = n % 10; if(w == 5 || q == 5 || b == 5 || s == 5 || g == 5){ cout<<w+q+b+s+g; }else{ cout<<n; } } /************************************************************** Problem: 1659 User: admin Language: C++ Result: Accepted Time:22 ms Memory:2072 kb ****************************************************************/