import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
// Press Shift twice to open the Search Everywhere dialog and type show whitespaces,
// then press Enter. You can now see whitespace characters in your code.
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
double a = Integer.parseInt(st.nextToken());
double b = Integer.parseInt(st.nextToken());
double c = Integer.parseInt(st.nextToken());
double d = Integer.parseInt(st.nextToken());
double e = Integer.parseInt(st.nextToken());
double total = Math.pow(a,2) + Math.pow(b,2)+Math.pow(c,2)+Math.pow(d,2)+
Math.pow(e,2);
System.out.println((int)total%10);
}
}