import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int g = n % 10;
int s = n / 10 % 10;
int b = n / 100 % 10;
int q = n / 1000 % 10;
int w = n / 10000;
if(g==5 || s==5 || b==5 || q==5 || w==5){
int s1 = g + s + b + q + w;
System.out.println(s1);
}else{
System.out.println(n);
}
sc.close();
}
}
/**************************************************************
Problem: 1659
User: admin
Language: Java
Result: Accepted
Time:1087 ms
Memory:39824 kb
****************************************************************/