import std.algorithm, std.conv, std.range, std.stdio, std.string; import std.container; // SList, DList, BinaryHeap import std.typecons; // Tuple, Nullable, BigFlags import std.math; // math functions import std.numeric; // gcd import std.bigint; // BigInt import std.random; // random import std.bitmanip; // BitArray import core.bitop; // bit operation import std.regex; // RegEx import std.uni; // unicode void main() { auto s = readln.chomp; auto n = s.map!(c => c.to!string.to!int).array; auto t = calc(n); writeln(min(t + n.length + t, n.length + t + n.length)); } auto calc(int[] n) { auto r = 1; foreach (c; n) { r += c.predSwitch(0, 1, 1, 0, 2, 0, 3, 0, 4, 1, 5, 0, 6, 1, 7, 0, 8, 2, 9, 1); } return r; }